The app opens with a splash screen (a picture, a hint, and so on) that stays for 2-3 seconds, then ends up and starts the first activity to be presented.
Handler's Postdelayed method is ideal for this function. It is equivalent to a timer that allows the thread where the handler is bound to delay execution of a piece of code.
Postdelayed (Runnable r,long uptimemillis);
The first parameter is a snippet of code to be executed lazily. The second parameter is the number of seconds to extend.
private handler mhandler = new handler (); @Override protected void oncreate (bundle savedinstancestate) { super.oncreate (savedinstancestate); intent intent = getintent (); setcontentview (r.layout.activity_welcome); Mhandler.postdelayed (new runnable () { @Override public void run () { startandfinishthis (); } &nbSP;}, 2500);
Android App splash Screen implementation