When you add a new activity in Android Studio. It will have a default back button at the upper left corner. How to remove it? I check many things online but they are not working. So, let’s remove it by ourselves!
Appcompat has a version which is v7.
Add the following line in the
The kotlin version is as the following:
I assume the Jave version should be using
getSupportActionBar() first to get an instance of
supportActionBar then trigger that method.
Just this one line, the trick here is when you invoke that
setDisplayHomeAsUpEnabled, it’s from
supportActionBar rather than
Here you go. Hope it helps. :)