How to restart Android app
-
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.
-
Hi,
Out of curiosity, why do you need to do that ?
-
@SGaist for fun :)
-
@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? -
@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?@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
-
@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?@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.