问题
I am implementing searchview with sherlock actionbar by refering https://stackoverflow.com/a/14085524/992665 but when I run the application I get the error as could not find the class SuggestionsAdapter. My log
12-30 13:13:39.929: E/dalvikvm(7286): Could not find class 'com.actionbarsherlock.widget.SuggestionsAdapter', referenced from method com.actionbarsherlock.widget.SearchView.updateSearchAutoComplete
12-30 13:13:39.932: E/dalvikvm(7286): Could not find class 'com.actionbarsherlock.widget.SuggestionsAdapter', referenced from method com.actionbarsherlock.widget.SearchView.setQueryRefinementEnabled
12-30 13:13:39.935: E/dalvikvm(7286): Could not find class 'com.actionbarsherlock.widget.SuggestionsAdapter', referenced from method com.actionbarsherlock.widget.SearchView$3.run
12-30 13:13:39.957: E/AndroidRuntime(7286): FATAL EXCEPTION: main
12-30 13:13:39.957: E/AndroidRuntime(7286): java.lang.NullPointerException
12-30 13:13:39.957: E/AndroidRuntime(7286): at com.example.sherlockdemo.MainActivity.onCreateOptionsMenu(MainActivity.java:43)
12-30 13:13:39.957: E/AndroidRuntime(7286): at com.actionbarsherlock.app.SherlockActivity.onCreatePanelMenu(SherlockActivity.java:184)
12-30 13:13:39.957: E/AndroidRuntime(7286): at com.actionbarsherlock.ActionBarSherlock.callbackCreateOptionsMenu(ActionBarSherlock.java:560)
12-30 13:13:39.957: E/AndroidRuntime(7286): at com.actionbarsherlock.internal.ActionBarSherlockNative.dispatchCreateOptionsMenu(ActionBarSherlockNative.java:64)
12-30 13:13:39.957: E/AndroidRuntime(7286): at com.actionbarsherlock.app.SherlockActivity.onCreateOptionsMenu(SherlockActivity.java:149)
12-30 13:13:39.957: E/AndroidRuntime(7286): at android.app.Activity.onCreatePanelMenu(Activity.java:2508)
12-30 13:13:39.957: E/AndroidRuntime(7286): at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:411)
12-30 13:13:39.957: E/AndroidRuntime(7286): at com.android.internal.policy.impl.PhoneWindow.doInvalidatePanelMenu(PhoneWindow.java:784)
12-30 13:13:39.957: E/AndroidRuntime(7286): at com.android.internal.policy.impl.PhoneWindow$1.run(PhoneWindow.java:205)
12-30 13:13:39.957: E/AndroidRuntime(7286): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:776)
12-30 13:13:39.957: E/AndroidRuntime(7286): at android.view.Choreographer.doCallbacks(Choreographer.java:579)
12-30 13:13:39.957: E/AndroidRuntime(7286): at android.view.Choreographer.doFrame(Choreographer.java:547)
12-30 13:13:39.957: E/AndroidRuntime(7286): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:762)
12-30 13:13:39.957: E/AndroidRuntime(7286): at android.os.Handler.handleCallback(Handler.java:725)
12-30 13:13:39.957: E/AndroidRuntime(7286): at android.os.Handler.dispatchMessage(Handler.java:92)
12-30 13:13:39.957: E/AndroidRuntime(7286): at android.os.Looper.loop(Looper.java:153)
12-30 13:13:39.957: E/AndroidRuntime(7286): at android.app.ActivityThread.main(ActivityThread.java:5297)
12-30 13:13:39.957: E/AndroidRuntime(7286): at java.lang.reflect.Method.invokeNative(Native Method)
12-30 13:13:39.957: E/AndroidRuntime(7286): at java.lang.reflect.Method.invoke(Method.java:511)
12-30 13:13:39.957: E/AndroidRuntime(7286): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
12-30 13:13:39.957: E/AndroidRuntime(7286): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
12-30 13:13:39.957: E/AndroidRuntime(7286): at dalvik.system.NativeStart.main(Native Method)
回答1:
After working on a while I ended up with the NullPointerException then found out that it was a bug in abs itself, thanks to https://stackoverflow.com/a/16903531/992665
来源:https://stackoverflow.com/questions/20835518/sherlock-actionbar-unable-to-find-class