SplashActivity.java
package com.example.adzonstore;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Window window = getWindow() ;
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_splash);
Thread splashTread = new Thread(){
@Override
public void run() {
try {
sleep(3000);
startActivity(new Intent(getApplicationContext(),MainActivity.class));
finish();
} catch (InterruptedException e) {
e.printStackTrace();
}
super.run();
}
};
splashTread.start();
}
}activity_splash
<?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:orientation="vertical"
tools:context=".SplashActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="250dp"
android:src="@drawable/logo"
android:scaleType="centerCrop"
android:padding="112dp"
android:layout_marginTop="160dp"/>
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="95dp"
android:layout_height="10dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="100dp"
android:indeterminate="true"
android:max="100"
android:progress="0"
/>
</LinearLayout>AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.adzonstore">
<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.AdzonStore">
<activity
android:name=".MainActivity"
android:exported="false" />
<activity
android:name=".SplashActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest

0 Comments
If your having doubt please let me know