I am working on android Version 8 and my emulator 2.2 I have tabview with Activity group, and multi childs and they are all listview but one is Activity the onbackPressed method is not working for the List Activity I have searcged and i found this code
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && CatalogGroup.group != null) {
CatalogGroup.group.popView();
return true;
}
return super.onKeyDown(keyCode, event);
}
the problem is popView() is undefined in the type Group Activity and this is my Code
public class TabsGroup extends ActivityGroup {
public static TabsGroup group;
// additional Code
}
and this is the back Code
public void back() {
if(history.size() > 0) {
history.remove(history.size()-1);
if (history.size() > 0)
setContentView(history.get(history.size()-1));
}else {
finish();
}
}
public void onBackPressed() {
CatalogGroup.group.back();
return;
}
How could I make the back button works for the ListView ?