NullPointerException when Using requestWindowFeature(Window.FEATURE_NO_TITLE) on ListActivity Extending Activity

Posted by ColorWP.com on Stack Overflow See other posts from Stack Overflow or by ColorWP.com
Published on 2012-11-08T10:58:34Z Indexed on 2012/11/08 11:00 UTC
Read the original article Hit count: 578

I have a ListActivity extending class and I am trying to hide the default TitleBar (I think it's called ActionBar) using the code below. It works on a regular activity, but not on the ListActivity. How do I accomplish the same in this scenario?

public class MyClass extends ListActivity{
    @Override
    public void onCreate(Bundle b) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        super.onCreate(b);
        // Tried Window.FEATURE_NO_TITLE here as well
        setContentView(R.layout.activity_myclass);
        getActionBar().setDisplayHomeAsUpEnabled(true);
    }
}

© Stack Overflow or respective owner

Related posts about android

Related posts about android-actionbar