Splash
public class Splash extends AppCompatActivity {
// Set the duration of the splash screen
private static final long SPLASH_SCREEN_DELAY = 3000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
TimerTask task = new TimerTask() {
@Override
public void run() {
// Start the next activity
Intent mainIntent = new Intent().setClass(
Splash.this, MainActivity.class);
startActivity(mainIntent);
// Close the activity so the user won't able to go back this
// activity pressing Back button
finish();
}
};
// Simulate a long loading process on application startup.
Timer timer = new Timer();
timer.schedule(task, SPLASH_SCREEN_DELAY);
}
}
Manifest
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true">
<activity
android:name=".Splash"
android:theme="@style/ThemeGallo.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />/<!--Quita ActionBar/ToolBar-->
</intent-filter>
</activity>
<activity android:name=".MainActivity">
</activity>
</application>
I hope and you can help me, Thanks.