Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt on Android : Working example of a splash screen
Forum Updated to NodeBB v4.3 + New Features

Qt on Android : Working example of a splash screen

Scheduled Pinned Locked Moved Mobile and Embedded
20 Posts 12 Posters 23.1k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Brexis
    wrote on last edited by
    #8

    Hi. If your are interested to make an animated Splash screen in QML, see "this post":https://qt-project.org/forums/viewthread/36745

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Muhammad
      wrote on last edited by
      #9

      #Larpon, I'm using Qt 5.3.1 and I used Qt creator to create the manifest file.
      In the splash screen section I see that the name set in
      @@drawable/logo@

      is the name of my logo. I don't know why, this should be for the splash screen, but it's not. I tried to change it manually, and I did put the splash in inside the

      @/path/to/project/android-build/res/drawable-mdpi/splash.png
      /path/to/project/android-build/res/drawable-ldpi/splash.png
      /path/to/project/android-build/res/drawable-hdpi/splash.png@

      but when I run the application all of this gets overwritten and the manifest return back to it's logo and I don't find the splash image in the directories above.
      Any Idea

      I don't have endpoint, I just have Checkpoints.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Muhammad
        wrote on last edited by
        #10

        #dominik.fehr, I also used the way you specified, it did work and show the splash screen, but the application still shows a black screen for around 4 seconds before showing the splash screen and then the application. apparently this splash is not a splash it is a part of the application.
        Any Idea
        Thanks

        I don't have endpoint, I just have Checkpoints.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DerMas
          wrote on last edited by
          #11

          #Baso
          Also on 5.3.1 and it works perfectly with the AndroidManifest method posted by Larpon.

          Are you editing the right folder? Since everything gets overwritten, it sounds like you are editing the android output folder and not the soure folder.

          Check if the project file has the line:
          @ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android_build@
          (Btw. since my project is quite old, the androidsource folder isnt called "android_build", but only "android". So check if the folder specified in the project file is the same, you use for your custom android files).

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Muhammad
            wrote on last edited by
            #12

            #DerMas
            You are right, I was editing the output folder. I edited the one in the project folder and everything works just fine.
            Thank you DerMas and thanks everybody.

            I don't have endpoint, I just have Checkpoints.

            1 Reply Last reply
            0
            • N Offline
              N Offline
              nologinma
              wrote on last edited by
              #13

              [code]
              #include "mainwindow.h"
              #include <QApplication>
              #include <QSplashScreen>
              #include <QTimer>

              int main(int argc, char *argv[])
              {
              QApplication a(argc, argv);
              MainWindow w;

              QPixmap pixmap(":/images/splash.png");
              QSplashScreen splash(pixmap);
              splash.show();
              
              QTimer::singleShot(3000, &splash, SLOT(close()));
              QTimer::singleShot(3000, &w, SLOT(show()));
              
              return a.exec&#40;&#41;;
              

              }
              [/code]
              This example work well but there is a big (for me) problem when I run the app in the Android device (no emulation).

              Before that the Splash Screen part, for a second the MainWindow showing the incon associated upper left. After start the Splash Screen and then the MainWindow.

              The intial second of the MainWindow is deleterious.

              I tried the following solution, but it does not work well at 100%

              [code]
              #include "mainwindow.h"
              #include <QApplication>
              #include <QSplashScreen>
              #include <QTimer>

              int main(int argc, char *argv[])
              {
              QApplication a(argc, argv);

              QPixmap pixmap(":/images/splash.png");
              QSplashScreen splash(pixmap);
              splash.show();
              
              MainWindow w;
              
              QTimer::singleShot(3000, &splash, SLOT(close()));
              QTimer::singleShot(3000, &w, SLOT(show()));
              
              return a.exec(&#41;;
              

              }
              [/code]

              If I run the app in my desktop I haven't problem.

              Inside the MainWindow I have a Menu.

              If I remove the Menu from MainWindow I haven't the problem.

              1 Reply Last reply
              0
              • benlauB Offline
                benlauB Offline
                benlau
                Qt Champions 2016
                wrote on last edited by
                #14

                In case you found that the action bar with your application name is shown together with your splash image. You may add this attribute to <activity> tag

                @
                android:theme="@android:style/Theme.Holo.Light.NoActionBar"
                @

                1 Reply Last reply
                0
                • N Offline
                  N Offline
                  nologinma
                  wrote on last edited by
                  #15

                  Thank you for the response but it doesn't resolve my problem.

                  if I add the following code:

                  @android:theme="@android:style/Theme.Holo.Light.NoActionBar"@

                  the splash screen is without action bar but also the next screen is without action bar.

                  The same result if I use:

                  @android:theme="@android:style/Theme.NoTitleBar"@

                  My application show the application screen without Title bar (ok) and after the next screen show the Title bar (perfect).

                  My problem is that the screen before splash screen (about 1 second) show the Title bar after it hide and show the Splash screen and after the screen with the title bar.

                  1 Reply Last reply
                  0
                  • benlauB Offline
                    benlauB Offline
                    benlau
                    Qt Champions 2016
                    wrote on last edited by
                    #16

                    Hi,

                    FYI, I have written an article about how to create a splash screen with instant response and will not turn black:

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

                    Pradeep P NP 1 Reply Last reply
                    2
                    • benlauB benlau

                      Hi,

                      FYI, I have written an article about how to create a splash screen with instant response and will not turn black:

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

                      Pradeep P NP Offline
                      Pradeep P NP Offline
                      Pradeep P N
                      wrote on last edited by
                      #17

                      Hi @benlau

                      But how this works with different resolution Android Screens as in my case the Splash Screen is not same in all devices (either enlarged or bulged)

                      Pradeep Nimbalkar.
                      Upvote the answer(s) that helped you to solve the issue...
                      Keep code clean.

                      jsulmJ 1 Reply Last reply
                      1
                      • Pradeep P NP Pradeep P N

                        Hi @benlau

                        But how this works with different resolution Android Screens as in my case the Splash Screen is not same in all devices (either enlarged or bulged)

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #18

                        @Pradeep-P-N From the link:
                        "1. Prepare a splash screen

                        It is not recommended to use a single image as the splash screen. It will be scaled to fill up all the space. Make it as a drawable resource is easier to fit for all devices."

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        Pradeep P NP 1 Reply Last reply
                        1
                        • jsulmJ jsulm

                          @Pradeep-P-N From the link:
                          "1. Prepare a splash screen

                          It is not recommended to use a single image as the splash screen. It will be scaled to fill up all the space. Make it as a drawable resource is easier to fit for all devices."

                          Pradeep P NP Offline
                          Pradeep P NP Offline
                          Pradeep P N
                          wrote on last edited by
                          #19

                          Hi @jsulm ,
                          Thank you, i found an other way and was able to solve it :)
                          cool :)
                          Thanks again for the support.

                          Pradeep Nimbalkar.
                          Upvote the answer(s) that helped you to solve the issue...
                          Keep code clean.

                          aha_1980A 1 Reply Last reply
                          1
                          • Pradeep P NP Pradeep P N

                            Hi @jsulm ,
                            Thank you, i found an other way and was able to solve it :)
                            cool :)
                            Thanks again for the support.

                            aha_1980A Offline
                            aha_1980A Offline
                            aha_1980
                            Lifetime Qt Champion
                            wrote on last edited by
                            #20

                            @Pradeep-P-N

                            wanne share your solution?

                            Qt has to stay free or it will die.

                            1 Reply Last reply
                            1

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved