To override the back button in an Android application,
override the Activity method onBackPressed() to return
public class MyActivity extends Activity {
@Override
public void onBackPressed() {
return;
}
}
Chintan commented that this snippet is also a solution:
@Override
public boolean onKeyDown(int keyCode,KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK
|| KeyEvent.KEYCODE_HOME == keyCode
|| KeyEvent.KEYCODE_SEARCH == keyCode)){
return false;
}
return super.onKeyDown(keyCode, event);
return false;
}
return super.onKeyDown(keyCode, event);