I have made a login app in android .The user gets logged in after giving the correct EMail-id and password but after logging in when i press the back button in my phone i again get redirected to the previous page i.e to my login page. I want to restrict this that when a user is logged in and if he/she presses the back button the user should remain in that page only.
Share
There is a function
onBackPressed()which you may override. Leave it empty if you don’t want it at all. Requires API level 5 (i.e. android 2.0 or later) As such: