I'm using android.support.v7.widget.SearchView like the following code.
<android.support.v7.widget.SearchView
android:id="@+id/search_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_toRightOf="@id/img_search"
android:closeIcon="@null"
android:searchIcon="@null"
android:iconifiedByDefault="false"
android:queryBackground="@android:color/transparent"/>
NPE occurred only in api level 21 with the fatal log.
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.drawable.Drawable.setState(int[])' on a null object reference
at android.widget.SearchView.updateCloseButton(SearchView.java:849)
at android.widget.SearchView.updateViewsVisibility(SearchView.java:798)
I figure it happened 'cause I set attribute is null of closeIcon and searchIcon.
How can I solve this problem wisely?