ActivityGroup with Window.FEATURE_CUSTOM_TITLE throws RuntimeException
-
09-10-2019 - |
Question
I'm working with an ActivityGroup
which is orientation-aware.
When the phone is in portrait-mode Activity
A should be started.
When in landscape-mode Activity
B should be started.
I do have a custom title in both of these activities, that is called within the corresponding onCreate
methods.
I call the initialisation of the custom title like this:
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
customTitleBar = new CustomTitleBar(getWindow());
Log.d(TAG, "onCreate called");
setContentView(R.layout.layout_a);
customTitleBar.init();
...
}
And it all works when I'm launching each Activity
on it's own.
But when trying to start them within the ActivityGroup
, my app crashes with this exception:
java.lang.RuntimeException: Unable to resume activity {foo.bar.MyActivityGroup}:
java.lang.RuntimeException: Unable to start activity ComponentInfo{foo.bar.ActivityA}:
android.util.AndroidRuntimeException:
You cannot combine custom titles with other title features
I'm not using any title feature within the ActivityGroup
. Is anyone able to help me with this issue?
Solution
It seems impossible to create an ActivityGroup
with custom titled Activities in it. Creating a Decorator
and passing the Activity
into this decorator solves the issue.