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. Map back to home
Qt 6.11 is out! See what's new in the release blog

Map back to home

Scheduled Pinned Locked Moved Mobile and Embedded
2 Posts 1 Posters 838 Views 1 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.
  • E Offline
    E Offline
    ebag
    wrote on last edited by
    #1

    With qt 5.3 in android, I prevent app from quiting like this:

    @Keys.onReleased:{
    if (event.key === Qt.Key_Back) {
    event.accepted = true;
    print('prevent');
    }
    }
    @

    And I want to put app in background when the back key is pressed. More likely the home key is pressed.
    Need Java code to do this?

    1 Reply Last reply
    0
    • E Offline
      E Offline
      ebag
      wrote on last edited by
      #2

      I try to use own Activity insteadof the default, but not work.
      @public class MyActivity extends org.qtproject.qt5.android.bindings.QtActivity
      {
      @Override
      public void onBackPressed() {
      Intent i= new Intent(Intent.ACTION_MAIN);
      i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      i.addCategory(Intent.CATEGORY_HOME);
      startActivity(i);
      }
      }@

      1 Reply Last reply
      0

      • Login

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