In my actionbar menu I have a searchview like this:
<item android:id="@+id/action_search"
    android:title="@string/action_search"
    android:icon="@drawable/ic_search_black_36dp"
    app:showAsAction="ifRoom|collapseActionView"
    app:actionViewClass="android.support.v7.widget.SearchView" />
the search icon does appear on the actionbar and when I click on it a text input field appears with a back button besides it and keyboard opens.
 
 
If i close the keyboard and press the back button the text field disappears but if I click on the back button when keyboard is open I get this error:
04-07 15:57:08.411  14736-14736/cheetar.xorjin E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.IllegalArgumentException: parameter must be a descendant of this view
        at android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:4257)
        at android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:4194)
        at android.view.ViewRootImpl.scrollToRectOrFocus(ViewRootImpl.java:2122)
        at android.view.ViewRootImpl.draw(ViewRootImpl.java:1842)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1634)
        at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:4448)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
        at dalvik.system.NativeStart.main(Native Method)
I used this answer to close the keyboard whenever something other than a textview is touched and it works fine except for when I click on that back button. How can I fix this?
If more information is needed please tell me what it is and I'll add it asap.
Thank you
 
     
     
    