android back navigation

Solutions on MaxInterview for android back navigation by the best coders in the world

showing results for - "android back navigation"
Jona
10 Mar 2019
1@Override
2public boolean onOptionsItemSelected(@NonNull MenuItem item) {
3  int itemId = item.getItemId();
4  if (itemId == android.R.id.home) {
5    // force up navigation to have the same behavior as temporal navigation
6    onBackPressed();
7    return true;
8  } else {
9    return super.onOptionsItemSelected(item);
10  }
11}