Fix ToolBar Navigation Back Button not Working Issue in Android Java

Android Fix HomeAsUp Button Not Working Error in Java

I experienced this error when i created a SettingsActivity for my app. I think the cause of this error was that i forgot to define a parentActivity while creating the SettingsActivity. The parent activity must defined because this is the activity where the app goes back when the HomeAsUp Button is clicked.

There are two ways to fix this, one easy way is by going to the manifest file and add this line of code in the activity name:


The second way is adding this code below the oncreate method:

ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } }

@Override public boolean onSupportNavigateUp() { 
return true; }

Related Posts

How to Export Project Zip from Android Studio

How to Export Source Code ZIP in Android Studio Sometimes, you will need export the source code of your android studio app project, to share it with…

Fix Plugin [id: ‘’, version: ‘7.1.3’, apply: false] was not found in any of the following sources

Here is how to fix Plugin [id: ‘’, version: ‘7.1.3’, apply: false] was not found in any of the following sources This error is caused by mismatching…

Get Age from Date of Birth in Java Android

Here is how to get a user’s age from date of birth If you need get a user’s age from a given date of birth string, this…

How to Check if String Array Contains a Specific String in Android

Here is how to get a specific value or String from Array in Android To check if a string array contains a specific string, you can use…

Make Android WebView Support Razorpay Payment

How to Support Razorpay Payment and UPI in Android WebView? Android webview is inexpensive and easy way to make apps for websites. But to support some specific…

Leave a Reply

Your email address will not be published. Required fields are marked *