I can successfully call activity.onPause() to pause the application.
But when i call activity.onResume() the application restarts.
Is there a way to avoid this ?
Edited
I actually want to pause my application using a pause button
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should never call methods of the
Activitylife cycle by yourself! So no call toonPause()onResume()onDestroy()onCreate()onStop()oronStart().Edit to fit your edited question:
You should pause your game, not the Activity. You must have a thread where you work your game logic. That thread needs to be paused, not the game. So consider working on a pause logic there.