我已经阅读了所有与我的代码中有相同错误的问题, 我不知道什么是错的,请帮帮我
FragmentSearch.java
adapter = new FunDapter<>(SearchFragment.this.getActivity(), itemList, R.layout.search_row, dic);
lv = (ListView)view.findViewById(R.id.lvSearch);
searcher = (SearchView) view.findViewById(R.id.Search);
lv.setAdapter(adapter);
searcher.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
return false;
}
@Override
public boolean onQueryTextChange(String s) {
adapter.getFilter().filter(s);
return false;
}
});
错误
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Filter.filter(java.lang.CharSequence)' on a null object reference
at com.example.junamay.matchdeals.Fragments.SearchFragment$5.onQueryTextChange(SearchFragment.java:148)
at android.widget.SearchView.onTextChanged(SearchView.java:1209)
at android.widget.SearchView.access$2000(SearchView.java:95)
at android.widget.SearchView$10.onTextChanged(SearchView.java:1689)
at android.widget.TextView.sendOnTextChanged(TextView.java:8175)
感谢ADVANCE