Samantha Withanage
Samantha Withanage

Reputation: 3851

Android prevent back key function from whole application

I have to prevent back key functionality in my android application whenever the back key is pressed. This should be applied for whole app. I'm new to android programming. Does someone can help me with some helpful code segment?

Upvotes: 0

Views: 290

Answers (3)

androider
androider

Reputation: 992

Overriding the onBackPressed event will do your work

Upvotes: 0

vinothp
vinothp

Reputation: 10069

You can change it by Overriding onBackPressed()

 @Override
 public void onBackPressed(){
   // You can Customise your Back key Functionality Over here.
 }

Upvotes: 0

meredrica
meredrica

Reputation: 2563

Subclass Activity and Fragment and override onBackPressed. You cannot simply disable the back key globally.

Upvotes: 1

Related Questions