event handling - How to relaunch the application which is exited by home button press in android? -


I have an Android app in which I only want to exit the application back press. I mean if the user clicks on the Home button, I want to exit the app but after a specific time I want to launch the app. How to get it?

If you want to restart the application then you can start a service service You can start your activity using code:

  intent dialogIntent = new (getBaseContext), myActivity.class); DialogIntent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK); . GetApplication () startActivity (dialogIntent);   

When you press the Home key, you can set a flag and check in the service to ensure that the application is in the background so that the activity is not unnecessarily reused. Ho.

This link may be helpful for you:

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -