Thursday 3 May 2012

Animation between screen change in Android

If you want to change your application screen with animation then following post help you. 1) First make anim folder in res and put all animation xml in anim folder. you can find animation xml in android demo application in android sdk. 2) Now write folowing code on your activity. 


public class Logo extends Activity 

private static final int SPLASH_DISPLAY_TIME = 2000;
/** Called when the activity is first created. */ 
@Override public void onCreate(Bundle savedInstanceState) 

super.onCreate(savedInstanceState); 
requestWindowFeature(Window.FEATURE_NO_TITLE); 
setContentView(R.layout.logo); 
new Handler().postDelayed(new Runnable() { 
public void run() { 
Intent intent = new Intent(); 
intent.setClass(Logo.this, Splesh.class); 
Logo.this.startActivity(intent); 
Logo.this.finish(); 
// transition from logo to splash 
overridePendingTransition(R.anim.activityfadein, R.anim.splashfadeout); 
} }, SPLASH_DISPLAY_TIME); 
} }

No comments:

Post a Comment