ad728

Friday, December 29, 2017

AIDE Tutorial - 46 Blink Animation

AIDE Tutorial - 46 Blink Animation
Java
package com.kcgroup.animblink;
import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;
import android.view.animation.*;
public class MainActivity extends Activity
{   @Override
    protected void onCreate(Bundle savedInstanceState)
    {super.onCreate(savedInstanceState);
        setContentView(R.layout.main);    }
public void blink(View v){
ImageView image=(ImageView)findViewById(R.id.mainImageView);
Animation an=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.blink);
image.startAnimation(an);}}
Main xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <ImageView
android:layout_weight="4"
        android:src="@drawable/ic_launcher"
android:id="@+id/mainImageView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
<Button
android:text="Blink"
android:onClick="blink"
android:layout_width="wrap_content"        android:layout_height="wrap_content" />
</LinearLayout>
Blink.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
>
<alpha android:fromAlpha="0"
android:toAlpha="1"
android:duration="1000"
android:repeatMode="reverse"
android:repeatCount="2"/>
</set>
Other Related Articles:
  1. AIDE Tutorial - 41 Animation Fade In & Fade Out
  2. AIDE Tutorial - 42 Animation Zoom In & Zoom Out
  3. AIDE Tutorial - 43 Animation Bounce Top Bottom Left Right
  4. AIDE Tutorial - 44 Rotate Animation
  5. AIDE Tutorial - 45 Slide Animation
  6. AIDE Tutorial - 46 Blink Animation
Share:

AIDE Tutorial - 43 Animation Bounce Top Bottom Left Right

AIDE Tutorial - 43 Animation Bounce Top Bottom Left Right

Watch the video below

Main Activity.java
package com.kcgroup.animbounce;
import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;
import android.view.animation.*;
public class MainActivity extends Activity
{    @Override
    protected void onCreate(Bundle savedInstanceState)    {        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);    }
public void top(View v){
ImageView image=(ImageView)findViewById(R.id.mainImageView);
Animation an=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.bounce_top);
image.startAnimation(an);}
public void bottom(View v){ImageView image=(ImageView)findViewById(R.id.mainImageView);
Animation an=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.bounce_bottom);
image.startAnimation(an);}
public void right(View v){
ImageView image=(ImageView)findViewById(R.id.mainImageView);
Animation an=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.bounce_right);
image.startAnimation(an);}
public void left(View v){ImageView image=(ImageView)findViewById(R.id.mainImageView);
Animation an=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.bounce_left);image.startAnimation(an);}}

Main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <ImageView
android:layout_weight="4"
android:id="@+id/mainImageView"
        android:src="@drawable/ic_launcher"
        android:layout_width="match_parent"        android:layout_height="wrap_content" />
<Button
android:text="Top"
android:onClick="top"
android:layout_width="match_parent"        android:layout_height="wrap_content" />
<Button
android:text="Bottom"
android:onClick="bottom"
android:layout_width="match_parent"        android:layout_height="wrap_content" />
<Button
android:text="Right"
android:onClick="right"
android:layout_width="match_parent"        android:layout_height="wrap_content" />
<Button
android:text="Left"
android:onClick="left"
android:layout_width="match_parent"        android:layout_height="wrap_content" />
</LinearLayout>
Create a new folder anim add four xml
Bounce_Bottom.xml
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:interpolator="@android:anim/bounce_interpolator">
<scale
android:duration="1000"
android:fromXScale="1"
android:fromYScale="0"
android:toXScale="1"
android:toYScale="1"></scale></set>
Bounce_left.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:interpolator="@android:anim/bounce_interpolator">
<scale
android:duration="1000"
android:fromXScale="1"
android:fromYScale="1"
android:toXScale="0"
android:toYScale="1"></scale></set>
Bounce_right.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:interpolator="@android:anim/bounce_interpolator">
<scale
android:duration="1000"
android:fromXScale="0"
android:fromYScale="1"
android:toXScale="1"
android:toYScale="1"></scale></set>

Bounce_Top.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
   android:fillAfter="true"
   android:interpolator="@android:anim/bounce_interpolator">
   <scale
   android:duration="1000"
   android:fromXScale="1"
   android:fromYScale="1"
   android:toXScale="1"
   android:toYScale="0"></scale></set>

Share:

Member Countries of G20

List of Member Countries of G 20

  1. Germany
  2. USA
  3. Russia
  4. UK
  5. Japan
  6. India
  7. South Africa
  8. Indonesia
  9. Turkey
  10. Australia
  11. France
  12. Canada
  13. Brazil
  14. China
  15. Argentina
  16. Mexico
  17. European Union
  18. Saudi Arabia
  19. South Korea
  20. Italy
Share:

Saturday, December 16, 2017

AIDE Tutorial - 50 Rating Bar

AIDE Tutorial - 50 Rating Bar
Watch the Video Below


Main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
   android:orientation="vertical" >
    <TextView
        android:text="Rate Our App"
        android:layout_width="wrap_content"       android:layout_height="wrap_content" />
<RatingBar
android:text="Rate: "
android:id="@+id/mainRatingBar"
android:layout_width="wrap_content"        android:layout_height="wrap_content" />
<TextView
android:textSize="20sp"
android:id="@+id/mainTextView"
android:text="Rating :"
android:layout_width="wrap_content"       android:layout_height="wrap_content" />
</LinearLayout>
MainActivity.java
package com.kcgroup.ratingbar;
import android.app.*;
import android.os.*;
import android.widget.*;
import android.widget.RatingBar.*;
public class MainActivity extends Activity
{    @Override
    protected void onCreate(Bundle savedInstanceState)   {        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
final TextView Result=(TextView)findViewById(R.id.mainTextView);
RatingBar RB=(RatingBar)findViewById(R.id.mainRatingBar);
RB.setOnRatingBarChangeListener(new OnRatingBarChangeListener(){
@Override
public void onRatingChanged(RatingBar arg0,float rating,boolean arg2){Result.setText("Rating :"+String.valueOf(rating));}});    }}
Share:

Thursday, December 14, 2017

AIDE Tutorial - 44 Rotate Animation

AIDE Tutorial - 44 Rotate Animation

Watch the Video Below

MainActivity.Java
package com.kcgroup.animrotate;
import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;
import android.view.animation.*;
public class MainActivity extends Activity
{ @Override

    protected void onCreate(Bundle savedInstanceState)    {        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);    }
public void cw(View v){ImageView image=(ImageView)findViewById(R.id.mainImageView);
Animation an=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.rotate_clockwise);
image.startAnimation(an);}
public void ccw(View v){ImageView image=(ImageView)findViewById(R.id.mainImageView);
Animation an=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.rotate_countercw);image.startAnimation(an);}}
Main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
   android:orientation="vertical" >
    <ImageView
android:layout_weight="4"
android:id="@+id/mainImageView"
        android:src="@drawable/ic_launcher"
        android:layout_width="match_parent"      android:layout_height="wrap_content" />
<Button
android:onClick="cw"
android:text="Clock Wise"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:onClick="ccw"
android:text="Counter Clock wise"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Rotate_clockwise.xml
<?xml version="1.0" encoding="utf-8"?>
<setxmlns:android="http://schemas.android.com/apk/res/android"
>
<rotate
android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="50%"
android:pivotY="50%"
android:duration="1000"
android:repeatCount="2"
android:interpolator="@android:anim/cycle_interpolator"/></set>
Rotate_CounterClockWise.xml
<?xml version="1.0" encoding="utf-8"?>
<setxmlns:android="http://schemas.android.com/apk/res/android"
>
<rotate
android:fromDegrees="360"
android:toDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:duration="1000"
android:repeatCount="2"
android:interpolator="@android:anim/cycle_interpolator"/></set>
Share:

Wednesday, December 13, 2017

AIDE Tutorial - 45 Slide Animation

AIDE Tutorial - 45 Slide Animation

Watch the Video Below
MainActivity.java
package com.kcgroup.animslide;
import android.app.*;
import android.os.*;
import android.widget.*;
import android.view.animation.*;
import android.view.*;
public class MainActivity extends Activity
{    @Override
    protected void onCreate(Bundle savedInstanceState)    {        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);    }
public void top(View v){
ImageView image=(ImageView)findViewById(R.id.mainImageView);
Animation an=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.silde_top);
image.startAnimation(an);}
public void bottom(View v){ImageView image=(ImageView)findViewById(R.id.mainImageView);
Animation an=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.silde_bottom);
image.startAnimation(an);}
public void right(View v){
ImageView image=(ImageView)findViewById(R.id.mainImageView);
Animation an=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.slide_right);
image.startAnimation(an);}
public void left(View v){ImageView image=(ImageView)findViewById(R.id.mainImageView);
Animation an=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.slide_left);
image.startAnimation(an);}}


Main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <ImageView
android:layout_weight="4"
android:id="@+id/mainImageView"
        android:src="@drawable/ic_launcher"
        android:layout_width="match_parent"        android:layout_height="wrap_content" />
<Button
android:onClick="top"
android:text="Top"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:onClick="bottom"
android:text="Bottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:onClick="right"
android:text="Right"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:onClick="left"
android:text="Left"
android:layout_width="wrap_content"
android:layout_height="wrap_content" /></LinearLayout>


Slide_bottom.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<scale
android:duration="2000"
android:fromXScale="1"
android:fromYScale="0"
android:toXScale="1"
android:toYScale="1"
android:interpolator="@android:anim/linear_interpolator"/>
</set>

Slide_left.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<scale
android:duration="2000"
android:fromXScale="1"
android:fromYScale="1"
android:toXScale="0"
android:toYScale="1"
android:interpolator="@android:anim/linear_interpolator"/>
</set>

Slide_right.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<scale
android:duration="2000"
android:fromXScale="0"
android:fromYScale="1"
android:toXScale="1"
android:toYScale="1"
android:interpolator="@android:anim/linear_interpolator"/>
</set>

Slide_top.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<scale
android:duration="2000"
android:fromXScale="1"
android:fromYScale="1"
android:toXScale="1"
android:toYScale="0"
android:interpolator="@android:anim/linear_interpolator"/>
</set>
Share:

Sunday, December 10, 2017

AIDE Tutorial - 49.1 Context Menu on ListView

AIDE Tutorial - 49.1 Context Menu on ListView

Watch the Video Below



Main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
    <ListView
android:id="@+id/mainTextView"
android:layout_width="wrap_content"      android:layout_height="wrap_content" />
</LinearLayout>
Main Activity.java
package com.kcgroup.CM;
import android.app.*;
import android.os.*;
import android.widget.*;
import android.view.*;
import android.view.ContextMenu.*;
public class MainActivity extends Activity
{ListView list;
    @Override
    protected void onCreate(Bundle savedInstanceState)   {       super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
list=(ListView)findViewById(R.id.mainTextView);

String[] name={"A","B","C","D"};
ArrayAdapter adapter=new ArrayAdapter(this,android.R.layout.simple_list_item_1,name);
list.setAdapter(adapter);
registerForContextMenu(list);    }
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)
{ // TODO: Implement this method
super.onCreateContextMenu(menu, v, menuInfo);
menu.setHeaderTitle("Select Action");
menu.add(0,v.getId(),0,"Call");
menu.add(0,v.getId(),0,"SMS");
menu.add(0,v.getId(),0,"VideoCall"); }
@Override
public boolean onContextItemSelected(MenuItem item)
{ if(item.getTitle()=="Call"){
Toast.makeText(this,"Call is Clicked",Toast.LENGTH_SHORT).show();
} else
if(item.getTitle()=="SMS"){
Toast.makeText(this,"SMS is Clicked",Toast.LENGTH_SHORT).show();
} else
if(item.getTitle()=="VideoCall"){ Toast.makeText(this,"VideoCall is Clicked",Toast.LENGTH_SHORT).show(); }
// TODO: Implement this method
return true; }}
Share:

AIDE Tutorial - 49 Context Menu on TextView

AIDE Tutorial - 49 Context Menu on TextView

Watch the Video Below



Main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center">
    <TextView
android:id="@+id/mainTextView"
android:textSize="25dp"
 android:text="Long Press to see context menu"        android:layout_width="wrap_content"       android:layout_height="wrap_content" />
</LinearLayout>
MainActivity.java
package com.kcgroup.CM;


import android.app.*;
import android.os.*;
import android.widget.*;
import android.view.*;
import android.view.ContextMenu.*;
public class MainActivity extends Activity
{TextView text;
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
text=(TextView)findViewById(R.id.mainTextView);
registerForContextMenu(text); }
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)

{ // TODO: Implement this method
super.onCreateContextMenu(menu, v, menuInfo);
menu.setHeaderTitle("Select Action");
menu.add(0,v.getId(),0,"Call");
menu.add(0,v.getId(),0,"SMS");
menu.add(0,v.getId(),0,"VideoCall");}
@Override
public boolean onContextItemSelected(MenuItem item)
{ if(item.getTitle()=="Call"){
Toast.makeText(this,"Call is Clicked",Toast.LENGTH_SHORT).show();} else
if(item.getTitle()=="SMS"){ Toast.makeText(this,"SMS is Clicked",Toast.LENGTH_SHORT).show(); } else
if(item.getTitle()=="VideoCall"){ Toast.makeText(this,"VideoCall is Clicked",Toast.LENGTH_SHORT).show();
} // TODO: Implement this method
return true;}}

Share:

Friday, December 8, 2017

AIDE Tutorial - 48 PopUp Menu

AIDE Tutorial - 48 PopUp Menu


Watch the Video Below



Main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center">
    <Button
android:onClick="popup"
        android:text="PopUp"
        android:layout_width="wrap_content"        android:layout_height="wrap_content" /> </LinearLayout>

Java
package com.kcgroup.popup; import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;
import android.widget.PopupMenu.*;
public class MainActivity extends Activity
{
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
public void popup(View v){
PopupMenu pop=new PopupMenu (this,v);
MenuInflater mi=pop.getMenuInflater();
mi.inflate(R.menu.popup, pop.getMenu());
pop.show();
pop.setOnMenuItemClickListener(new OnMenuItemClickListener(){
@Override
public boolean onMenuItemClick(MenuItem aaa)
{ if(aaa.getItemId()==R.id.call){ Toast.makeText(getApplicationContext(),"Call is clicked",Toast.LENGTH_SHORT).show();}
if(aaa.getItemId()==R.id.sms){ Toast.makeText(getApplicationContext(),"SMS is clicked",Toast.LENGTH_SHORT).show();}
if(aaa.getItemId()==R.id.video){ Toast.makeText(getApplicationContext(),"Video Call is clicked",Toast.LENGTH_SHORT).show();}
// TODO: Implement this method
return true; }});}}
Create a new folder and add pop.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android">
   
    <item
        android:id="@+id/call"
        android:title="Call"/>
<item
        android:id="@+id/sms"
        android:title="SMS"/>
<item
        android:id="@+id/video"
        android:title="Video Call"/>
   
</menu>
Share:

Total Pageviews

Sponsor

Sponsor

ad300

Blog Archive