Step No 1:
AndroidManifest.xml
<application>
<activity android:name=".SplashScreen"          
      android:configChanges="screenSize|orientation"
      android:screenOrientation="portrait">
      <intent-filter>
         <action android:name="android.intent.action.MAIN" />
         <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
</activity>
</application>

Step No 2:
activity_splash_screen.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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:background="@drawable/bg"   
android:layout_gravity="center"  
android:gravity="center"   
android:orientation="vertical"   
tools:context=".SplashScreen">

    <ImageView       
                    android:layout_width="200dp"       
                    android:layout_height="200dp"      
                     android:background="@drawable/icon"
                     android:layout_gravity="center" />
</LinearLayout>

Step No 3:
SplashScreen.java
import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;

public class SplashScreen extends AppCompatActivity {

    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_splash_screen);

        new Handler().postDelayed(new Runnable() {
            @Override            public void run() {
                Intent intent = new Intent(getApplicationContext(), MainActivity.class);
                startActivity(intent);
                finish();
            }
        },3000);
    }
}


Share To:

M - TECHS

Post A Comment:

0 comments so far,add yours

If you find any mistake about that post. So feel free to inform me thanks