Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support v7 ActionBar API > 21 #12

Closed
AnguelSC opened this issue Nov 25, 2015 · 6 comments
Closed

support v7 ActionBar API > 21 #12

AnguelSC opened this issue Nov 25, 2015 · 6 comments

Comments

@AnguelSC
Copy link

Hi, I'm using the Library but for Lollipop devices when I go to preferences, the application stops. Giving me an error.

void android.support.v7.app.ActionBar.setHomeButtonEnabled(boolean)

@ferrannp
Copy link
Owner

Hello, please could you explain what do you mean here?

@AnguelSC
Copy link
Author

Hi, this is the detail error

@ferrannp
Copy link
Owner

ferrannp commented Dec 3, 2015

I think you didn't copy the error detail?

@cmatsuoka
Copy link

I just stumbled on a similar problem after updating appcompat-v7 to version 23.1.1:

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setHomeButtonEnabled(boolean)' on a null object reference
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
    at android.app.ActivityThread.access$800(ActivityThread.java:144)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5221)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setHomeButtonEnabled(boolean)' on a null object reference
    at com.fnp.materialpreferences.PreferenceActivity.onCreate(PreferenceActivity.java:44)

It happens in getSupportActionBar().setHomeButtonEnabled(true); in PreferenceActivity's onCreate method.

@ferrannp
Copy link
Owner

ferrannp commented Jan 2, 2016

That's probably because you are using a theme without action bar in >21 ? I think I just need to check for null and use always a toolbar in the lib. Let's see if I have a moment to fix this. Thanks for reporting. I think it's the same as #11

@cmatsuoka
Copy link

Indeed, this was the problem. Silly me! Thanks :)

    <activity
        android:name=".preferences.Preferences"
        android:theme="@style/AppTheme.NoActionBar" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants