Search code examples
androidandroid-themeandroid-holo-everywhere

_HoloActivity$HoloThemeException: You must apply Holo.Theme, Holo.Theme.Light or Holo.Theme.Light.DarkActionBar theme


I'm using HoloEverywhere-1.6.8.

I have a custom theme that is based upon Holo.Theme.

<style name="JumbleeTheme" parent="Holo.Theme"> ... </style>

I'm getting the crash below but it is only appearing for the following devices:

  • Galaxy Tab 10.1 P7510 10.1" 800*1280 149ppi Android#4.0
  • HT EVO 4G 4.3" 480*800 217ppi Android#2.3
  • Galaxy S2 4.3" 480*800 217ppi Android#2.3

android.support.v4.app._HoloActivity$HoloThemeException: You must apply Holo.Theme, Holo.Theme.Light or Holo.Theme.Light.DarkActionBar theme on the activity (SplashActivity) for using HoloEverywhere

  at android.support.v4.app._HoloActivity.onInit(SourceFile:482)
  at android.support.v4.app._HoloActivity.forceInit(SourceFile:223)
  at org.holoeverywhere.app.Activity.onCreate(SourceFile:215)
  at au.com.xandar.jumblee.AbstractAppActivity.onCreate(SourceFile:80)
  at au.com.xandar.jumblee.splash.SplashActivity.onCreate(SourceFile:34)
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:130)
  at android.app.ActivityThread.main(ActivityThread.java:3687)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:507)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
  at dalvik.system.NativeStart.main(Native Method)

Has anyone got any ideas on why this is only occurring for such a small subset of devices and what I can do about it?


Solution

  • AFAICT there is absolutely nothing wrong with either my code or with HoloEverywhere.

    For some inexplicable reason those devices sometimes seem to lose the Holo.Theme attribute from the Activity's style. This causes HE to throw an Exception.

    In case anyone else falls into this error this is the work around I am going with.

    @Override
    protected Holo onCreateConfig(Bundle savedInstanceState) {
        final Holo config = super.onCreateConfig(savedInstanceState);
        config.ignoreThemeCheck = true;
        return config;
    }
    

    As this will cause HE not to check that a a HE theme has been defined.