i am making a security application ,in which when application goes in background and again comes in foreground i have to prompt for password. going in background means when user press 'home' key or phone get locked automatically.and again when user start application i have to ask for password. can i implement this in onResume()of activity, but problem will occour when user switch to another activity from one activity onResume() will be called in another activity also. can someone tell me how to implement this response will be highly appriciable.