Feature Custom Title: Cannot combine custom titles on API 11 and above

kinghomer picture kinghomer · Sep 5, 2012 · Viewed 11.6k times · Source

I have a project in which i setted:

  • minSdkversion setted to 10
  • MainActivity is a TabActivity

Code in onCreate method is this:

super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);
...

With previous settings, all works well! But, if i set minSdkVersion to 11 or above, this exception occurs:

android.util.AndroidRuntimeException: You cannot combine custom titles with other title features

I don't understand why happens this just changing minSdkVersion. I red a lot about this problem on this site. I tried setting:

  • Theme.NoTitleBar in main layout and after in Manifest file too
  • I put those 3 lines in all possible positions
  • If i comment first line a NullPointerException occurs when i call something on my TextView reference of my CustomTitle layout
  • I tried setting, in theme.xml file declaration, "windowNoTitle" = true

Since i'm using functions available from API 11 only, i want to set minSdk to 11 before loading App on Store. How can i do ?? I need Help

Edit: With minSdkVersion = 10 and Theme.NoTitleBar in Manifest, same error occurs. Removing it, all works as before. Can anyone provide a working code (manifest and activity code) for setting a custom title when API is 11 or above ? Thx much

Answer

kinghomer picture kinghomer · Oct 30, 2012

Fixed by my self. I don't know why, but simply adding in manifest file "theme" property for each activity's declaration, all works:

From this:

<activity
        android:name=".CheckActivity"
        android:configChanges="orientation"
        android:screenOrientation="portrait"
</activity>

To this:

<activity
        android:name=".CheckActivity"
        android:configChanges="orientation"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme" >
</activity>