I have an ActionBar implemented as well as a SearchView widget in my app. It works just fine on the Nexus 7, HTC Sensation, etc. – anywhere where the Android version is older than 3.0 I believe. But it doesn’t run on the phone with the Android 2.3.5.
Is there anyway to “not display” the action bar and other unsupported stuff when the program runs on the old device?
Here is the error log I get when run in on my old device, sorry for the length, don’t really understand which bit is useful:
09-27 12:15:03.008: I/dalvikvm(824): Failed resolving Lcom/example/stroke/handling/MainActivity; interface 407 'Landroid/widget/SearchView$OnQueryTextListener;'
09-27 12:15:03.008: W/dalvikvm(824): Link of class 'Lcom/example/stroke/handling/MainActivity;' failed
09-27 12:15:03.008: D/AndroidRuntime(824): Shutting down VM
09-27 12:15:03.008: W/dalvikvm(824): threadid=1: thread exiting with uncaught exception (group=0x400205a0)
09-27 12:15:03.018: E/AndroidRuntime(824): FATAL EXCEPTION: main
09-27 12:15:03.018: E/AndroidRuntime(824): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.stroke.handling/com.example.stroke.handling.MainActivity}: java.lang.ClassNotFoundException: com.example.stroke.handling.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.stroke.handling-1.apk]
09-27 12:15:03.018: E/AndroidRuntime(824): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1743)
09-27 12:15:03.018: E/AndroidRuntime(824): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1851)
09-27 12:15:03.018: E/AndroidRuntime(824): at android.app.ActivityThread.access$1500(ActivityThread.java:132)
09-27 12:15:03.018: E/AndroidRuntime(824): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
09-27 12:15:03.018: E/AndroidRuntime(824): at android.os.Handler.dispatchMessage(Handler.java:99)
09-27 12:15:03.018: E/AndroidRuntime(824): at android.os.Looper.loop(Looper.java:150)
09-27 12:15:03.018: E/AndroidRuntime(824): at android.app.ActivityThread.main(ActivityThread.java:4277)
09-27 12:15:03.018: E/AndroidRuntime(824): at java.lang.reflect.Method.invokeNative(Native Method)
09-27 12:15:03.018: E/AndroidRuntime(824): at java.lang.reflect.Method.invoke(Method.java:507)
09-27 12:15:03.018: E/AndroidRuntime(824): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-27 12:15:03.018: E/AndroidRuntime(824): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-27 12:15:03.018: E/AndroidRuntime(824): at dalvik.system.NativeStart.main(Native Method)
09-27 12:15:03.018: E/AndroidRuntime(824): Caused by: java.lang.ClassNotFoundException: com.example.stroke.handling.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.stroke.handling-1.apk]
09-27 12:15:03.018: E/AndroidRuntime(824): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
09-27 12:15:03.018: E/AndroidRuntime(824): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
09-27 12:15:03.018: E/AndroidRuntime(824): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
09-27 12:15:03.018: E/AndroidRuntime(824): at android.app.Instrumentation.newActivity(Instrumentation.java:1040)
09-27 12:15:03.018: E/AndroidRuntime(824): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1735)
09-27 12:15:03.018: E/AndroidRuntime(824): ... 11 more
P.S. I don’t want to use ActionBarSherlock!
Oopsie,
Is it the answer to my question?
Edit: that sample app is shit.