Lancer mon application dans la méthode onUserLeaveHint
Bonjour,
Je n'arrive pas à lancer mon application dans onUserLeaveHint. En fait, le but aurait été que je ne sorte jamais de mon application mais je n'arrive pas à écouter le bouton home dans mon onkeyDown.
Donc je me suis dit pourquoi ne pas lancer mon application au moment où j’appuie sur le bouton home.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| public void onUserLeaveHint() { // this only executes when Home is selected.
//onRestart();
Log.e("log_tag", "onUserLeaveHint ");
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName("com.tuto.test","com.tuto.test.Main"));
startActivity(intent);
//performDial();
Log.e("log_tag", "passe ");
// super.onUserLeaveHint();
} |
Quelqu'un saurait-il m'expliquer comment faire ?
Merci d'avance pour votre aide.