How do I add a welcome picture to my app? A splash activity? Can someone explain how it works. I work with Android. MT manager It is an Android Mobile APK. I would like to see my welcome picture for 1-3 seconds when you start my app. How i do this?
Asked
Active
Viewed 68 times
1
-
Does this answer your question? [How do I make a splash screen?](https://stackoverflow.com/questions/5486789/how-do-i-make-a-splash-screen) – Marek Loose Nov 02 '20 at 18:54
-
no, it is very difficult to do it with a mobile phone – Simon Lewandosli Nov 02 '20 at 20:42
1 Answers
2
First you must create a layout for the applocation start (welcome screen) or (splash screen) and add what ever you want inside it, In my case I will call it "splash_layout", And then add this codes to your Main Activity
And it's done like this :
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
int seconds_in_millis = 2000 ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// here the welcome screen will show
setContentView(R.layout.splash_layout);
// this code makes the main screen shows after 2 seconds
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
setContentView(R.layout.activity_main);
}
},seconds_in_millis) ;
}
}
finally , every 1000 millis = 1 second.

a7d.24_
- 170
- 1
- 12