0

I am having an edit text, and while the user is entering data in it, i want the back button to be disabled. Please help if anyone has done this before.

bharath
  • 953
  • 4
  • 17
  • 30

2 Answers2

1

You can override the onBackPressed() method of your activity.

But please think about this twice. Normally this is nothing the user would expect.

Community
  • 1
  • 1
micha
  • 47,774
  • 16
  • 73
  • 80
  • Hi thanks for the reply, but i want to stop back button only when the edittext is on, rest of the time, i want the user to use the back button, inside edittext can we do this? – bharath Apr 26 '13 at 19:56
  • Also, this is not working for edittext if i place this in the main activity! – bharath Apr 26 '13 at 19:58
0

Try using this link: Disable back button in android

   @Override
       public void onBackPressed() {
   }

Requires API Level 5 or higher.

This is a duplicate question and this answer seems to do what you want.

Community
  • 1
  • 1
reidisaki
  • 1,525
  • 16
  • 29