Hi, Show a toast with "tap again to quit" on the first tap and then quit on the second tap. That's the common behavior of closing app. It would help in avoiding accidental closing and confirming to the user that the app is really going to be quit.
Cheers, F. On Oct 7, 2016 9:39 PM, "Eddie Sutton" <eddie.of.the.s...@gmail.com> wrote: On Oct 7, 2016, at 2:26 PM, Gianluca <gmax...@gmail.com> wrote: Il giorno 07 ott 2016, alle ore 20:19, Eddie Sutton < eddie.of.the.s...@gmail.com> ha scritto: On Oct 7, 2016, at 2:15 PM, Gianluca <gmax...@gmail.com> wrote: Il giorno 07 ott 2016, alle ore 20:09, Eddie Sutton < eddie.of.the.s...@gmail.com> ha scritto: Thank you for your reply Jason. On Oct 7, 2016, at 1:01 PM, Jason H <jh...@gmx.com> wrote: It seems like the activity catches it and removes itself from the stack. Is it crashing? If so paste the exception. I think maybe you are correct. I see no exceptions in adb. Instead it appeared the app was closed deliberately. Perhaps the problem is that I do not understand the Android back button. Does an Android user expect the back button to close an app? D/TSR (25898): ../source/source/mainwindow.cpp:812 (virtual void tcmw::*MainWindow::closeEvent*(QCloseEvent*)): ************************* C L O S E ****************** I/ActivityManager( 563): Process com.ditchwitch.tsr (pid 25898) (adj 9) has died. I/WindowState( 563): WIN DEATH: Window{42c61a48 u0 com.ditchwitch.tsr/com.ditchwitch.tsr.tsractivity.TsrActivity} W/WindowManager( 563): Force-removing child win Window{42caa3f8 u0 SurfaceView} from container Window{42c61a48 u0 com.ditchwitch.tsr/com.ditchwitch.tsr.tsractivity.TsrActivity} I expected Android button to retain my app state, suspend app to background, then restore suspended state when reactivated. Default behavior of Android on back button is to terminate the application. If you don’t want this behavior you have to capture the back button and handle. This is not Qt thing … it happens also if you are programming in Java. http://www.androiduipatterns.com/2011/03/back-button-behavior.html So most Android users will be irritated if I intercept the back button and do not let the app close?? I thought the Android back button was supposed to back-track through the apps the user had opened before the current app. :-D one thing is what the Android system does by default … another is what the users except :-D So, what users except are: - if the app is its very first screen, pressing back button will exit from the app and go to the home screen but when the user will open the app again is expecting to see exactly the same state as before like the app was in the background. So you should save the status and restart the app has it should never been stopped. - if the app is into an internal page, pressing back button will just navigate backward into the history (or app views structure) without exiting from the app. But unfortunately this is up to the programmers to do into the Android world :-( I think since my UI is a tab control, I will let the app close and any Bluetooth discovered devices or Bluetooth connections will be closed. Then re-launching will re-start the app at the default tab and users will have to scan again for B;bluetooth devices. Thank you for taking time to explain it to me! -Ed >Has anyone seen this? I cannot find any useful clues in adb. The app terminates unless I add a keyReleaseEvent to accept the Key_Back. #if defined(Q_OS_ANDROID) /// /// Android back button kills TSR ? /// /// Adding a keyReleaseEvent that accepts the event prevents the crash. /// I do not understand reason why. /// /// Ignoring the Android back button will annoy users but is better than crashing. /// void MainWindow::keyReleaseEvent(QKeyEvent *event) { if( Qt::Key_Back == event->key()) { qDebug("Android Back button"); event->setAccepted(true); } } #endif Thanks in advance, -Ed _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/ mailman/listinfo/interest _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest