Map back to home



  • 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?



  • 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);
    }
    }@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.