Tell me, please, how to implement Asyntask for the next task, I have a MainActivity in which there is a ListView containing 1000 elements. I need to start another Activity before the MainActivity , containing only a picture, it took 2 seconds, the Activity disappears and the MainActivity appears.

    1 answer 1

    This is called Splash Screen

    Here is an example implementation:

     public class SplashScreen extends Activity { private static int SPLASH_TIME_OUT = 2000; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); new Handler().postDelayed(new Runnable() { @Override public void run() { Intent i = new Intent(SplashScreen.this, MainActivity.class); startActivity(i); finish(); } }, SPLASH_TIME_OUT); } } 

    The meaning of the code I think there is no need to explain.

    • Thank you very much! Everything is clear and understandable! - FoRomik