How to surf trough screens using screen timeout

Assume you have two activities First Activity and Second Activity. To go to the second activity from the first activity without tapping add the below code into the 'onCreate' class in the activity.
Here we use the android Handler

 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,  
 WindowManager.LayoutParams.FLAG_FULLSCREEN);new android.os.Handler().postDelayed(new Runnable() {  
       @Override  
       public void run() {  
         Intent i1 = new Intent(FirstActivity.this, SecondActivity.class);  
         startActivity(i1);  
       }  
     }, 3000);  

According to the above code the time it takes to go to the next screen it takes 3 seconds (3000 milli seconds)

Comments

Popular posts from this blog

Using buttons in Android

Adding app bar to a single activity when it is removed from the styles.xml file