Wednesday 2 May 2012

Auto Switch between tow activity in android

Our First Activity class Logo. :-



public class Logo extends Activity {
private static final int SPLASH_DISPLAY_TIME = 4000;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   requestWindowFeature(Window.FEATURE_NO_TITLE);
        // making it full screen
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        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();


            }
        }, SPLASH_DISPLAY_TIME);
   // TODO Auto-generated method stub
}

}

Second Activity Class Splesh :-


public class Splesh extends Activity {
private static final int SPLASH_DISPLAY_TIME = 4000;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   requestWindowFeature(Window.FEATURE_NO_TITLE);
        // making it full screen
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
 
        setContentView(R.layout.splesh);
     
        new Handler().postDelayed(new Runnable() {
            public void run() {

                Intent intent = new Intent();
                intent.setClass(Splesh.this, NewActivity.class);

                Splesh.this.startActivity(intent);
                Splesh.this.finish();
     

            }
        }, SPLASH_DISPLAY_TIME);
   // TODO Auto-generated method stub
}


}



No comments:

Post a Comment