How to make the startup screen?

I wanted to make my app look more professional, so I decided to make an initial screen.

How do I create it and implement it?

#1 building

public class MainActivity extends Activity {


public void onCreate(Bundle savedInstanceState) {


    Thread t=new Thread()

        public void run()

            try {

                Intent cv=new Intent(MainActivity.this,HomeScreen.class/*otherclass*/);

            catch (InterruptedException e) {

#2 building

Note that this solution does not allow users to wait more: the delay in the startup screen depends on the application's startup time.

When you open any android application, some black screens appear by default, with icons at the top and the application at the top, which you can change using styles / themes.

First, create a style.xml in the values folder and add styles to it.

<style name="splashScreenTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
    <item name="android:windowBackground">@drawable/splash_screen</item>

Besides using @android : style/Theme.DeviceDefault.Light.NoActionBar you can also use any other theme as a parent theme.

Second, in your application Manifest.xml, put android:theme="@style/splashScreenTheme" into your main activity.

        android:theme="@style/splashScreenTheme" >

Third, update the theme in the onCreate() launch activity.

protected void onCreate(Bundle savedInstanceState) {
    // Make sure this is before calling super.onCreate

Update to view this article Thank you @ mat1h and @ adelriosantiago

#3 building

By default, splash screen does not automatically make your application look more professional. A professionally designed startup screen can make your application look more professional, but if you don't know how to write it, the rest of the applications will actually be more professional.

The only reason you have a splash screen (excuse) is because you are doing a lot of calculations or waiting for GPS / WiFi to start, because your application depends on before it starts. Without the results of these calculations or the inability to use GPS / WiFi (and so on), your application will die in the water, so you will feel that you need to start the screen and must block the screen view of any other running programs (including background programs).

Such a splash screen should look like your full screen application to give the impression that it has been initialized, and then after a lengthy calculation, you can fill in the final details (adjust the image). There is little chance that this is the case or that this is the only way to program.

It is best to allow users (and the rest of the operating system) to perform other operations while waiting, rather than designing programs to rely on programs that take some time (waiting time is uncertain).

There is already an icon on the phone indicating that GPS / WiFi is starting. The time or space occupied by the initial screen can be used to load pre calculations or actually perform calculations. See the first link below for questions you create and questions you must consider.

If you absolutely have to wait for these calculations or GPS / WiFi, it's best to just let the application start and pop up a pop-up indicating that you have to wait for these calculations (TEXTUAL "initializing" message is OK). You may need to wait for GPS / WiFi (if they are not already enabled in other programs), so you don't need to announce its wait time.

Remember, when the startup screen starts, the program is actually running. All you have to do is delay using the program and delay CPU / GPU to perform most unnecessary operations.

Every time we start the program, we'd better wait and see your startup screen, otherwise we won't think it's professional. Making the startup screen "full screen" and repeating it with the actual program screen (so we think it's not actually initialized) may achieve your goal (make your program look more professional), but I won't bet on that.

Why not: http : //

How do you do it? https : //´╝čq = Android + splash + screen + source

Therefore, there are good reasons not to do so, but if you are sure that your situation is beyond the scope of these examples, the above provides a way to do so. Make sure it does make your application look more professional, or you've beat the only reason to do so.

Like the YouTube channel, each video starts with a lengthy graphic profile (and Outro), or feels like it's necessary to tell a joke or explain what happened in the past week (not a comedy or lifestyle channel). Just show! (just run the program.).

#4 building

Example of startup screen:

public class MainActivity extends Activity {
    private ImageView splashImageView;
    boolean splashloading = false;

    protected void onCreate(Bundle savedInstanceState) {
        splashImageView = new ImageView(this);
        splashloading = true;
        Handler h = new Handler();
        h.postDelayed(new Runnable() {
            public void run() {
                splashloading = false;

        }, 3000);



#5 building

The answer above is good, but I'd like to add it. I'm a new Android user, and I've encountered these problems in the development process. I hope it can help people like me.

  1. The splash screen is the entry to my application, so add the following lines to Android manifest.xml.

     <activity android:name=".SplashActivity" android:theme="@android:style/Theme.DeviceDefault.Light.NoActionBar"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
  2. The initial screen should only be displayed once in the application lifecycle, and I use Boolean variables to record the status of the initial screen, and only for the first time.

    public class SplashActivity extends Activity { private static boolean splashLoaded = false; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!splashLoaded) { setContentView(R.layout.activity_splash); int secondsDelayed = 1; new Handler().postDelayed(new Runnable() { public void run() { startActivity(new Intent(SplashActivity.this, MainActivity.class)); finish(); } }, secondsDelayed * 500); splashLoaded = true; } else { Intent goToMainActivity = new Intent(SplashActivity.this, MainActivity.class); goToMainActivity.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(goToMainActivity); finish(); } } }

Happy coding!

Tags: Android xml Google REST

Posted on Tue, 14 Jan 2020 23:43:52 -0800 by phrater