Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Android™ Development

Reply
Contributor
Posts: 18
Registered: ‎05-15-2013
My Device: 9700
My Carrier: vodafone

ActionBar android NullPointerException

i want to enable the android actionBar, however it doesnt work for me

here is my MainActivity:

 

public void onCreate(Bundle savedInstanceState) {

        this.requestWindowFeature(Window.FEATURE_NO_TITLE);


        super.onCreate(savedInstanceState);
        setContentView(R.layout.login);

        ActionBar actionBar = getActionBar();
        actionBar.show();

}

Contributor
Posts: 34
Registered: ‎05-02-2013
My Device: 9700
My Carrier: Idea

Re: ActionBar android NullPointerException

You Actionbar returns null because you don't have actionbar but you are requesting using getActionbar()

Make sure that you've window feature to show your actionbar, That is required for the actionbar to show. Check the below links for more details. ...check this question getActionBar returns null And also check this link for the more information on your problem http://blog.perpetumdesign.com/2011/08/strange-case-of-dr-action-and-mr-bar.html

other

remove

android:theme="@style/AppTheme"
Highlighted
Contributor
Posts: 18
Registered: ‎05-15-2013
My Device: 9700
My Carrier: vodafone

Re: ActionBar android NullPointerException

Thanks for ur reply
Contributor
Posts: 18
Registered: ‎05-15-2013
My Device: 9700
My Carrier: 919909743132

Re: ActionBar android NullPointerException

The Action Bar does not work with this...
this.requestWindowFeature(Window.FEATURE_NO_TITLE);

you have to use theme.holo.no_title for no title to display.....