Friday, September 17, 2021

How we use Splash Screen in Android Studio.

                          Java code for simple splash screen Activity

Add this in Java class of Splash screen

getSupportActionBar().hide();
Thread thread=new Thread(new Runnable() {
@Override
public void run() {
try {
sleep(5000);
Intent i=new Intent(splash_screen.this,MainActivity.class);
startActivity(i);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
});
thread.start();


Change the names of Main_activity and splash_activity in manifest file with one another.


Add this in manifest file in splash activity

android:noHistory="true"

No comments:

Post a Comment