How do I put the back button on my Android toolbar?

How do I put the back button on my Android toolbar?
Answer
Add Back Button in Action Bar
  1. Create action bar variable and call function getSupportActionBar() in the java/kotlin file.
  2. Show back button using actionBar. setDisplayHomeAsUpEnabled(true) this will enable the back button.
  3. Custom the back event at onOptionsItemSelected.
 

Tìm kiếm

Back
Top