Android

Splash Screen in Android

Create Project : Splash

Step 1) first copy your logo pic drabbles folder..</span >

Step 2) open java folder </span >on the com,example.splash

right click on it , create new empty activity…</span >

 

Step 3) little change in Manifest file…</span >

In this code i moved launcher code SplashActivity …</span >


AndroidManifest.xml


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.splash">

<

application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.Splash">
        <activity android:name=".SplashActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

<category android:name=”android.intent.category.LAUNCHER” />
</intent-filter>

</

activity>
        <activity android:name=".MainActivity">

</

activity>

<

meta-data
            android:name="preloaded_fonts"
            android:resource="@array/preloaded_fonts" />
    </application>

</

manifest>
 
 
Activity_Splash.xml
 
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_centerInParent="false"
    android:layout_centerHorizontal="false"
    android:layout_centerVertical="false"
    tools:context=".SplashActivity">

<ImageView
android:id=”@+id/imageView”
android:layout_width=”203dp”
android:layout_height=”207dp”
android:layout_centerInParent=”true”
app:srcCompat=”@drawable/logos”
tools:srcCompat=”@drawable/logos” />

<TextView
android:id=”@+id/textView”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_alignParentBottom=”true”
android:layout_centerInParent=”true”
android:layout_marginBottom=”136dp”
android:fontFamily=”@font/artifika”
android:text=”Animi World”
android:textSize=”36sp”
android:textStyle=”bold” />

</RelativeLayout>




SplashActivity.java
 
package com.example.splash;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;

public class SplashActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
getSupportActionBar().hide();

Thread thread = new Thread(){
public void run(){
try{
sleep(3500);
}
catch(InterruptedException e){
e.printStackTrace();
} finally {
Intent openMain = new Intent(SplashActivity.this, MainActivity.class);
startActivity(openMain);
finish();
}
}
};
thread.start();
}
}