Android splash screen Qt 5.5



  • This is not questions, this answer for me and other users. After start Qt application on android we see black screen, app icon and app name, in process load. For a production this is not be good. Solutions, splash screen. But change AndroidManifest.xml and uncomment

    <meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/splash"/>

    not help for me. Because i see for half seconds, black screen, logo, title app (preload).

    What i do.

    Change AndroidManifest.xml

    add

    <activity
    android:name="org.stir.extension.SplashActivity"
    android:label="@string/app_name"
    android:screenOrientation="portrait"
    android:theme="@android:style/Theme.Black.NoTitleBar" >
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    </activity>

    for a main activity. And uncomment

    <meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/splash"/>

    now we have tow splash screen.

    SplashActivity.java code

    package org.stir.extension;

    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;

    import android.util.Log;

    import android.widget.LinearLayout;
    import android.widget.ImageView;
    import android.view.Window;
    import android.view.WindowManager;

    public class SplashActivity extends Activity
    {
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.splash);
    Thread logoTimer = new Thread()
    {
    public void run()
    {
    try
    {
    sleep(500);
    startActivity(new Intent("org.stir.extension.AndroidExtension"));
    }
    catch (InterruptedException e)
    {
    e.printStackTrace();
    }
    finally
    {
    finish();
    }
    }
    };
    logoTimer.start();
    }
    }

    SplashActivity run is app activity. We have tow splash screen. If you splash image in SplashActivity and QtActivity will be different. Change QtActivity::onCreate

    //getWindow().setBackgroundDrawable

    and set you resize bipmap. Now i have perfect app preload. Sleep after start activity is not good, but so far i can`t find best solutions.


  • Qt Champions 2016

    See this article to get the instruction to create a splash screen without black screen and show immediately:

    Complete Guide to Making a Splash Screen for your QML Android Application — Medium


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.