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. How to restart Android app
QtWS25 Last Chance

How to restart Android app

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
6 Posts 4 Posters 774 Views
  • 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.
  • M Offline
    M Offline
    Mantas.Kast
    wrote on last edited by
    #1

    Hello, I need a way to restart Qt app. I tried use this code:

    #include <QApplication>
    #include <QProcess>
    
    ...
    
    // restart:
    qApp->quit();
    QProcess::startDetached(qApp->arguments()[0], qApp->arguments());
    

    but it work only on Windows. However Qt doc do not say it cannot work on Android.

    I also tried this example, but it's buggy. Sometimes the app restarts, but the activity do not load and app stucks on white screen.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Out of curiosity, why do you need to do that ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      rajeabhilashR 1 Reply Last reply
      0
      • M Offline
        M Offline
        Mantas.Kast
        wrote on last edited by Mantas.Kast
        #3

        @SGaist for fun :)

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          Out of curiosity, why do you need to do that ?

          rajeabhilashR Offline
          rajeabhilashR Offline
          rajeabhilash
          wrote on last edited by
          #4

          @SGaist Hey, I'm Translating My Android App. As it has dynamic components, It does not translate to other languages instantly but If I closed App and Restart it is translated.
          Is there any way to restart Qt Android App within Code?
          Or Can we change Translate dynamic contents which are in qsTr() in runtime?

          One Life Baby..!

          J.HilkJ SGaistS 2 Replies Last reply
          0
          • rajeabhilashR rajeabhilash

            @SGaist Hey, I'm Translating My Android App. As it has dynamic components, It does not translate to other languages instantly but If I closed App and Restart it is translated.
            Is there any way to restart Qt Android App within Code?
            Or Can we change Translate dynamic contents which are in qsTr() in runtime?

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @rajeabhilash said in How to restart Android app:

            Or Can we change Translate dynamic contents which are in qsTr() in runtime?

            yes you can,

            qsTr() ? So its a QML application ?

            Question 1: what version of Qt do you use, because in older versions you had to do much more work than in the new ones.

            Question 2: how and where do you load the translations? Can you show the related code?

            With that we can help much more


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            0
            • rajeabhilashR rajeabhilash

              @SGaist Hey, I'm Translating My Android App. As it has dynamic components, It does not translate to other languages instantly but If I closed App and Restart it is translated.
              Is there any way to restart Qt Android App within Code?
              Or Can we change Translate dynamic contents which are in qsTr() in runtime?

              SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @rajeabhilash Hi and welcome to devnet,

              Beside the good points made by @J-Hilk, you can find the information for recent versions of Qt right into the QtQuick internationalisation documentation here.

              If on older versions of Qt, you may need the technique described in this wiki page.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              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