java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.SearchView.setOnQueryTextListener(android.support.v7.widget.SearchView$OnQueryTextListener)' on a null object reference

tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    How to implement search menu in contextual action mode

    Stack Overflow | 6 months ago | Prashant Sharma
    java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.SearchView.setOnQueryTextListener(android.support.v7.widget.SearchView$OnQueryTextListener)' on a null object reference

    Root Cause Analysis

    1. java.lang.NullPointerException

      Attempt to invoke virtual method 'void android.support.v7.widget.SearchView.setOnQueryTextListener(android.support.v7.widget.SearchView$OnQueryTextListener)' on a null object reference

      at com.kitpl.futuretext.ContactsActivity$1.onCreateActionMode()
    2. com.kitpl.futuretext
      ContactsActivity$1.onCreateActionMode
      1. com.kitpl.futuretext.ContactsActivity$1.onCreateActionMode(ContactsActivity.java:96)
      1 frame
    3. Android Platform
      AbsListView$MultiChoiceModeWrapper.onCreateActionMode
      1. android.widget.AbsListView$MultiChoiceModeWrapper.onCreateActionMode(AbsListView.java:6188)
      1 frame
    4. Android
      PhoneWindow$DecorView$ActionModeCallbackWrapper.onCreateActionMode
      1. com.android.internal.policy.impl.PhoneWindow$DecorView$ActionModeCallbackWrapper.onCreateActionMode(PhoneWindow.java:3279)
      1 frame
    5. Android v7
      WindowCallbackWrapper.onWindowStartingActionMode
      1. android.support.v7.view.SupportActionModeWrapper$CallbackWrapper.onCreateActionMode(SupportActionModeWrapper.java:155)
      2. android.support.v7.app.AppCompatDelegateImplV7$ActionModeCallbackWrapperV7.onCreateActionMode(AppCompatDelegateImplV7.java:1742)
      3. android.support.v7.app.AppCompatDelegateImplV7.startSupportActionModeFromWindow(AppCompatDelegateImplV7.java:802)
      4. android.support.v7.app.AppCompatDelegateImplV7.startSupportActionMode(AppCompatDelegateImplV7.java:696)
      5. android.support.v7.app.AppCompatDelegateImplV14$AppCompatWindowCallbackV14.startAsSupportActionMode(AppCompatDelegateImplV14.java:187)
      6. android.support.v7.app.AppCompatDelegateImplV14$AppCompatWindowCallbackV14.onWindowStartingActionMode(AppCompatDelegateImplV14.java:171)
      7. android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode(WindowCallbackWrapper.java:145)
      7 frames
    6. Android
      PhoneWindow$DecorView.startActionModeForChild
      1. com.android.internal.policy.impl.PhoneWindow$DecorView.startActionMode(PhoneWindow.java:2699)
      2. com.android.internal.policy.impl.PhoneWindow$DecorView.startActionModeForChild(PhoneWindow.java:2686)
      2 frames
    7. Android Platform
      ActivityThread.main
      1. android.view.ViewGroup.startActionModeForChild(ViewGroup.java:700)
      2. android.view.ViewGroup.startActionModeForChild(ViewGroup.java:700)
      3. android.view.ViewGroup.startActionModeForChild(ViewGroup.java:700)
      4. android.view.ViewGroup.startActionModeForChild(ViewGroup.java:700)
      5. android.view.ViewGroup.startActionModeForChild(ViewGroup.java:700)
      6. android.view.ViewGroup.startActionModeForChild(ViewGroup.java:700)
      7. android.view.View.startActionMode(View.java:4881)
      8. android.widget.AbsListView.performLongPress(AbsListView.java:3111)
      9. android.widget.AbsListView$CheckForLongPress.run(AbsListView.java:3070)
      10. android.os.Handler.handleCallback(Handler.java:739)
      11. android.os.Handler.dispatchMessage(Handler.java:95)
      12. android.os.Looper.loop(Looper.java:135)
      13. android.app.ActivityThread.main(ActivityThread.java:5254)
      13 frames
    8. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invoke(Native Method)
      2. java.lang.reflect.Method.invoke(Method.java:372)
      2 frames
    9. Android
      ZygoteInit.main
      1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
      2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
      2 frames