i want to work with action bar in android.
for this i use
getActionBar().setHomeButtonEnabled(true);
below the SetContentView . but is gives me null pointer exception.
when i try only getActionBar() it works fine.
please help me.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If your activity does not have a
title barthe methodgetActionBar()can return null.You have two options to fix this:
1- Add
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);beforesetContentView2- In your
Manifestspecify a Theme that supportsActionBarAlso make sure that you are targeting the right android version e.g.
<uses-sdk android:minSdkVersion="11" />