Android: override default Back Button action in TabActivity

I found that it is impossible to override Back button action in TabActivity.
You should do it in the hosted activities

@Override
		 public void onBackPressed() {
			 Log.i("beshkin","[onBackPressed()] pressed");
			 getParent().moveTaskToBack(true); return;
		 }

In this example, pressing Back button will put your app to back. Default behaviour will close it.
Note: you should put back you TabActivity, not hosted activity.

Leave a Reply

%d bloggers like this: