datetimepicker icon indicating copy to clipboard operation
datetimepicker copied to clipboard

Cannot use this library when you're using the new Google Toolbar.

Open forlayo opened this issue 10 years ago • 1 comments

Hello gentlemen,

If you try to use this library with new Google Toolbar, you'll get a crash every time that you open your application. ( because for using new Toolbar control of material design, is mandatory to extend from AppCompat. )

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.blabla/com.blabla.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2394)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2452)
            at android.app.ActivityThread.access$900(ActivityThread.java:172)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1302)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5586)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

That's because you're extending you library theme from android:Theme.Holo.Light or android:Theme.Light depending of api level; and you're using default Android theme configurations, I mean using AppBaseTheme and AppTheme.

A workaround for this issue was changing my base theme to something diferent from AppBaseTheme and also changing my base theme to something different than AppTheme.

I suggest you to extend from AppCompat or almost change your base theme to something different than default one; because maybe some of novice or not advanced devs will have problems trying to fix this issue.

Thanks a lot for your work and your library, hope this info helps to someone. Regards.

forlayo avatar Nov 27 '14 17:11 forlayo

Same issue here. A solution coming any time soon?

dirkvranckaert avatar Jan 07 '15 09:01 dirkvranckaert