0

I am using a trick to avoid showing the actionbar while the application loads. Such trick works perfect in typical Android systems, but fail on Amazon Kindle Fires.

It involves setting the actionbar to false in the application theme, then re-enable it in onCreate:

theme:

 <item name="android:windowActionBar">false</item> 
 <item name="android:windowTitleSize">0dp</item>

onCreate:

public void onCreate() {
    .
    .
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    setContentView(resourceId);
}

The call to requestFeature() has to be made before the setContentView() -Android Spec-. This works fine for normal Android devices. However, on Kindle Fire HDX, this doesnt' work!

Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content

I have not added, as you see, the content myself before this call. I suspect Amazon's Android does something under the hood because their actionbars and system bars are totally different to Stock Android, and this breaks this functionality.

Any idea? As I suppose the answer is "don't use that trick", is it possible to declare themes in Manifest conditionally for different devices?

rupps
  • 9,712
  • 4
  • 55
  • 95

0 Answers0