I receive the following error in Android Studio "Android Monitor"
There's a lot of mumbo-jumbo but it's essentially saying the cause of the error is the following:
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference
at com.example.robthoms.photopop.SettingsActivity.onCreate(SettingsActivity.java:28)
I'm trying to make Settings work on the Toolbar and I got the code from:
https://www.androidhive.info/2017/07/android-implementing-preferences-settings-screen/
If you click on this link you'll see the entire code for SettingsActivity.java that I'm trying to use but when I click on "settings" in toolbar, App closes.
What is wrong with SettingsActivity that the app closes?
My AndroidManifest.xml:
My styles.xml
Hides ActionBar in classes while styles.xml has Light.DarkActionBar
ActionBar bar = getSupportActionBar () ;
if (bar != null) bar.hide () ;