Step 1 Select empty activity in android studio for New Project
Step 2 Name the App name whatever you want
Step 3 After Loading of Gradle, Right Click on Java ,then Select New and search for Activity Button and then Select empty Activity.
Step 4 Name the empty Acticity to Be Splash Activity
JUST COPY THE CODES BELOW TO YOUR ANDROID PROJECT
For any Query Ask me in Comment Box Thank You……..
Codes are Given Below for Splash_activity xml, Splash_background xml Splash_activity Java etc…
Mipmap
Add Image or logo to Mipmap
Splash_activity xml
Blank…………………….
Manifest File
<manifest xmlns:android=”http://schemas.android.com/apk/res/android”
package=”com.e.mint”>
<
applicationandroid:allowBackup=”true”
android:icon=”@mipmap/ic_launcher”
android:label=”@string/app_name”
android:roundIcon=”@mipmap/ic_launcher_round”
android:supportsRtl=”true”
android:theme=”@style/AppTheme”>
<activity android:name=”.LoginActivity”></activity>
<activity
android:name=”.SplashActivity”
android:theme=”@style/SplashTheme”>
<intent-filter>
<action android:name=”android.intent.action.MAIN” />
<
category android:name=”android.intent.category.LAUNCHER” /></intent-filter>
</activity>
<activity android:name=”.MainActivity”>
<intent-filter>
<action android:name=”android.intent.action.MAIN” />
<
category android:name=”android.intent.category.LAUNCHER” /></intent-filter>
</activity>
</application>
</
manifest>Colour xml
<?xml version="1.0" encoding="utf-8"?><resources>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#03DAC5</color>
</resources>
Splash Activity Background xml
<?xml version="1.0" encoding="utf-8"?><layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="@color/colorPrimary"/>
</shape>
</item>
<item>
<bitmap android:src="@mipmap/logo" android:gravity="center"/>
</item>
</layer-list>
Splash Activity Java
package com.e.mint;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.SystemClock;
public class SplashActivity extends AppCompatActivity {
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
SystemClock.sleep(3000);
Intent loginIntent = new Intent(SplashActivity.this,LoginActivity.class);
startActivity(loginIntent);
finish();
}
}
Style xml
<resources>
<!-- Base application theme. --><style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowBackground">@drawable/splash_activity_background</item>
</style>
</resources>
Splash activity background xml
<resources>
<!-- Base application theme. --><style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowBackground">@drawable/splash_activity_background</item>
</style>
</resources>