i getting runtimeexception on android 2.3.5 am using theme.appcompat (res/values/themes.xml). phone: http://www.gsmarena.com/samsung_galaxy_y_s5360-4117.php
<!-- res/values/themes.xml --> <?xml version="1.0" encoding="utf-8"?> <resources> <style name="theme.styled" parent="@style/theme.appcompat"> <item name="actionbarstyle">@style/queryactionbar</item> <item name="android:actionbarstyle">@style/queryactionbar</item> </style> <style name="queryactionbar" parent="@style/widget.appcompat.actionbar"> <item name="background">@color/blueback</item> <item name="android:background">@color/blueback</item> <item name="backgroundsplit">@color/blueback</item> <item name="android:backgroundsplit">@color/blueback</item> </style> </resources> here file values-v11.
<!-- res/values-v11/themes.xml --> <?xml version="1.0" encoding="utf-8"?> <resources> <style name="querytheme" parent="@android:style/theme.holo"> <!-- customizations app running on devices theme.holo here --> </style> </resources> here error.
java.lang.runtimeexception: unable start activity componentinfo{com.txt2lrn.www/com.txt2lrn.www.landingactivity}: java.lang.illegalstateexception: need use theme.appcompat theme (or descendant) activity. @ android.app.activitythread.performlaunchactivity(activitythread.java:1651) @ android.app.activitythread.handlelaunchactivity(activitythread.java:1667) @ android.app.activitythread.access$1500(activitythread.java:117) @ android.app.activitythread$h.handlemessage(activitythread.java:935) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:130) @ android.app.activitythread.main(activitythread.java:3687) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:507) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:867) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:625) @ dalvik.system.nativestart.main(native method) caused by: java.lang.illegalstateexception: need use theme.appcompat theme (or descendant) activity. @ android.support.v7.app.actionbaractivitydelegate.oncreate(actionbaractivitydelegate.java:102) @ android.support.v7.app.actionbaractivity.oncreate(actionbaractivity.java:98) @ com.txt2lrn.www.landingactivity.oncreate(landingactivity.java:95) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) @ android.app.activitythread.performlaunchactivity(activitythread.java:1615) ... 11 more sorry folks, have android:theme="@style/theme.styled" defined in androidmanifest.xml.
if extending actionbaractivity in mainactivity, have change parent theme in values-v11 also.
style.xml in values-v11 -
<!-- res/values-v11/themes.xml --> <?xml version="1.0" encoding="utf-8"?> <resources> <style name="querytheme" parent="@style/theme.appcompat"> <!-- customizations app running on devices theme.holo here --> </style> </resources> edit: recommend stop using actionbar , start using appbar layout included in android design support library
Comments
Post a Comment