I have a class extending ListActivity
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);
}
}
The result is a NullPointerException. The full error stack trace is here if you need it: http://pastebin.com/VLR5dE8m
To remove the actionbar: getActionBar().hide(). Also see this answer: How to disable action bar permanently