In my app there is Activity A (main, parent) and B (child). When user is on A I want Back button to exit the app, not to go to history (B-A-B-A etc), since it makes no sense in this app. A has a ListView populated from sqlite, with items edited in B. If I call finish() in B after or instead intent to return to A, LisView(A) doesn´t get updated (I already call notifyDataSetChanged() in onCreate and onResume). I already navigated similar posts but couldn't find a solution to my case
try this :
@Override
public void onBackPressed() {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
}