I am using an ActivityGroup to spawn multiple activities and switch views from within the same tab in a TabActivity.
When I press the back key this method is called inside my ActivityGroup
public void back() {
if(history.size() > 0) {
history.remove(history.size()-1);
if (history.size() > 0)
setContentView(history.get(history.size()-1));
else
initView();
}else {
finish();
}
}
this method allows me to keep a stack of my activities and go back to the previous one when the back key is pressed.
this is working well on all my nested activities, except on a ListActivity where a press on the back key will simply exit the application.