Answers for "android back press toolbar"

1

android add back button to toolbar

getSupportActionBar().setDisplayHomeAsUpEnabled(true);getSupportActionBar().setDisplayShowHomeEnabled(true);
Posted by: Guest on June-25-2021
0

android back press toolbar

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
    case android.R.id.home:
        // this takes the user 'back', as if they pressed the left-facing    

      triangle icon on the main android toolbar.
        // if this doesn't work as desired, another possibility is to call   

        stopActivityTask();  // finish() here.
        getActivity().onBackPressed();
        return true;
    default:
        return super.onOptionsItemSelected(item);
}
}
Posted by: Guest on September-17-2021
0

android add back button to toolbar

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);setSupportActionBar(toolbar);
Posted by: Guest on June-25-2021

Code answers related to "android back press toolbar"

Browse Popular Code Answers by Language