Ad Code

Responsive Advertisement

How to Create Welcome Screen (Splash Screen) in Android Studio

How to Create Welcome Screen (Splash Screen) in Android Studio?


Splash Screen is most commonly the first startup screen which appears when App is opened. In other words, it is a simple constant screen for a fixed amount of time which is used to display the company logo, name, advertising content etc.










Normally it shows when app is first time launched on android device or it may be some kind of process that is used to show screen to user just before the app loads completely.

This tutorial will help you to learn How to create Splash screen in your Android app.






Splash_Activity.java


package com.anni.webviewandroidapps;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;
import android.view.WindowManager;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {

Intent i = new
Intent(MainActivity.this, WebView.class);
startActivity(i);
finish();

}
},3000);


}
}


Splash_Activity.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"
tools:context=".MainActivity">


<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/welcome"/>



</RelativeLayout>


 

Reactions

Post a Comment

0 Comments