As mentioned in several answers, calling requestWindowFeature(Window.FEATURE_NO_TITLE)
should be before super.onCreate(...)
and setContentView(...)
.
However, I want the screen's title to appear when the activity is created, and to disappear only after returning from another activity.
I tried this:
public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case REQUEST_CONNECT_DEVICE:
requestWindowFeature(Window.FEATURE_NO_TITLE);
}
}
And I'm getting the android.util.AndroidRuntimeException: requestFeature() must be called before adding content
exception.