SearchView in Toolbar not filtering ListFragment
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I'm trying to implement a SearchView
within a Toolbar
for a ListFragment
, but for some reason filtering is not working. The SearchView
and keyboard appear as normal, but the ListView
does not get filtered as I type something in.
fragment class
public class MyFragment extends ListFragment implements SearchView.OnQueryTextListener {
public MyFragment() {}
private ListView lv;
private MyListAdapter mAdapter;
public static MyFragment newInstance() {
return new MyFragment();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_list, container, false);
initialize();
return view;
}
List<Product> myList = new ArrayList<>();
private void initialize() {
String items = getActivity().getResources().getStringArray(R.array.product_names);
String itemDescriptions = getActivity().getResources().getStringArray(R.array.product_descriptions);
for (int n = 0; n < items.length; n++){
Product product = new Product();
product.setProductName(items[n]);
product.setProductDescription(itemDescriptions[n]);
myList.add(product);
}
mAdapter = new MyListAdapter(myList, getActivity());
setListAdapter(mAdapter);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
View v = getView();
mTwoPane = getActivity().findViewById(R.id.detail_container) != null;
assert v != null;
lv = v.findViewById(android.R.id.list);
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
MyListAdapter adapter = (MyListAdapter) parent.getAdapter();
}
});
super.onActivityCreated(savedInstanceState);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
MenuInflater mInflater = Objects.requireNonNull(getActivity()).getMenuInflater();
mInflater.inflate(R.menu.menu_search, menu);
MenuItem searchitem = menu.findItem(R.id.action_search);
SearchView searchView = (SearchView) searchitem.getActionView();
searchView.setQueryHint(Objects.requireNonNull(getContext()).getText(R.string.searchhint_productname));
super.onCreateOptionsMenu(menu, inflater);
}
}
adapter class
public class MyListAdapter extends BaseAdapter implements Filterable {
private List<Product> myList;
private List<Product> myListFull;
private LayoutInflater mInflater;
public MyListAdapter(List<Product> data, Context context) {
myList = data;
myList = new ArrayList(myList);
myListFull = new ArrayList(myList);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
return myList.size();
}
@Override
public Object getItem(int position) {
return myList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MyListAdapter.ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.listitem, parent, false);
holder = new MyListAdapter.ViewHolder();
holder.title = convertView.findViewById(R.id.listitem_title);
holder.description = convertView.findViewById(R.id.listitem_subtitle);
convertView.setTag(holder);
} else {
holder = (MyListAdapter.ViewHolder) convertView.getTag();
}
Product mProduct = (Product)getItem(position);
holder.title.setText(mProduct.getProductName());
holder.description.setText(mProduct.getProductDescription());
return convertView;
}
/**
* View holder
*/
static class ViewHolder {
private TextView title;
private TextView description;
}
@Override
public Filter getFilter() {
return exampleFilter;
}
private Filter exampleFilter = new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
List<Product> filteredList = new ArrayList<>();
if (constraint == null || constraint.length() == 0) {
filteredList.addAll(myListFull);
} else {
String filterPattern = constraint.toString().toLowerCase().trim();
for (Product item : myListFull) {
if (item.getProductName().toLowerCase().contains(filterPattern)) {
filteredList.add(item);
}
}
}
FilterResults results = new FilterResults();
results.values = filteredList;
return results;
}
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
myList.clear();
myList.addAll((List<Product>) results.values);
notifyDataSetChanged();
}
};
}
java android android-listview android-adapter android-listfragment
add a comment |
I'm trying to implement a SearchView
within a Toolbar
for a ListFragment
, but for some reason filtering is not working. The SearchView
and keyboard appear as normal, but the ListView
does not get filtered as I type something in.
fragment class
public class MyFragment extends ListFragment implements SearchView.OnQueryTextListener {
public MyFragment() {}
private ListView lv;
private MyListAdapter mAdapter;
public static MyFragment newInstance() {
return new MyFragment();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_list, container, false);
initialize();
return view;
}
List<Product> myList = new ArrayList<>();
private void initialize() {
String items = getActivity().getResources().getStringArray(R.array.product_names);
String itemDescriptions = getActivity().getResources().getStringArray(R.array.product_descriptions);
for (int n = 0; n < items.length; n++){
Product product = new Product();
product.setProductName(items[n]);
product.setProductDescription(itemDescriptions[n]);
myList.add(product);
}
mAdapter = new MyListAdapter(myList, getActivity());
setListAdapter(mAdapter);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
View v = getView();
mTwoPane = getActivity().findViewById(R.id.detail_container) != null;
assert v != null;
lv = v.findViewById(android.R.id.list);
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
MyListAdapter adapter = (MyListAdapter) parent.getAdapter();
}
});
super.onActivityCreated(savedInstanceState);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
MenuInflater mInflater = Objects.requireNonNull(getActivity()).getMenuInflater();
mInflater.inflate(R.menu.menu_search, menu);
MenuItem searchitem = menu.findItem(R.id.action_search);
SearchView searchView = (SearchView) searchitem.getActionView();
searchView.setQueryHint(Objects.requireNonNull(getContext()).getText(R.string.searchhint_productname));
super.onCreateOptionsMenu(menu, inflater);
}
}
adapter class
public class MyListAdapter extends BaseAdapter implements Filterable {
private List<Product> myList;
private List<Product> myListFull;
private LayoutInflater mInflater;
public MyListAdapter(List<Product> data, Context context) {
myList = data;
myList = new ArrayList(myList);
myListFull = new ArrayList(myList);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
return myList.size();
}
@Override
public Object getItem(int position) {
return myList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MyListAdapter.ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.listitem, parent, false);
holder = new MyListAdapter.ViewHolder();
holder.title = convertView.findViewById(R.id.listitem_title);
holder.description = convertView.findViewById(R.id.listitem_subtitle);
convertView.setTag(holder);
} else {
holder = (MyListAdapter.ViewHolder) convertView.getTag();
}
Product mProduct = (Product)getItem(position);
holder.title.setText(mProduct.getProductName());
holder.description.setText(mProduct.getProductDescription());
return convertView;
}
/**
* View holder
*/
static class ViewHolder {
private TextView title;
private TextView description;
}
@Override
public Filter getFilter() {
return exampleFilter;
}
private Filter exampleFilter = new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
List<Product> filteredList = new ArrayList<>();
if (constraint == null || constraint.length() == 0) {
filteredList.addAll(myListFull);
} else {
String filterPattern = constraint.toString().toLowerCase().trim();
for (Product item : myListFull) {
if (item.getProductName().toLowerCase().contains(filterPattern)) {
filteredList.add(item);
}
}
}
FilterResults results = new FilterResults();
results.values = filteredList;
return results;
}
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
myList.clear();
myList.addAll((List<Product>) results.values);
notifyDataSetChanged();
}
};
}
java android android-listview android-adapter android-listfragment
1
You would need to callsetTextFilterEnabled(true)
on theListView
. However, if you check the documentation for that method, theAdapter
class you use must implement theFilterable
interface.
– Mike M.
Nov 21 '18 at 23:37
add a comment |
I'm trying to implement a SearchView
within a Toolbar
for a ListFragment
, but for some reason filtering is not working. The SearchView
and keyboard appear as normal, but the ListView
does not get filtered as I type something in.
fragment class
public class MyFragment extends ListFragment implements SearchView.OnQueryTextListener {
public MyFragment() {}
private ListView lv;
private MyListAdapter mAdapter;
public static MyFragment newInstance() {
return new MyFragment();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_list, container, false);
initialize();
return view;
}
List<Product> myList = new ArrayList<>();
private void initialize() {
String items = getActivity().getResources().getStringArray(R.array.product_names);
String itemDescriptions = getActivity().getResources().getStringArray(R.array.product_descriptions);
for (int n = 0; n < items.length; n++){
Product product = new Product();
product.setProductName(items[n]);
product.setProductDescription(itemDescriptions[n]);
myList.add(product);
}
mAdapter = new MyListAdapter(myList, getActivity());
setListAdapter(mAdapter);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
View v = getView();
mTwoPane = getActivity().findViewById(R.id.detail_container) != null;
assert v != null;
lv = v.findViewById(android.R.id.list);
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
MyListAdapter adapter = (MyListAdapter) parent.getAdapter();
}
});
super.onActivityCreated(savedInstanceState);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
MenuInflater mInflater = Objects.requireNonNull(getActivity()).getMenuInflater();
mInflater.inflate(R.menu.menu_search, menu);
MenuItem searchitem = menu.findItem(R.id.action_search);
SearchView searchView = (SearchView) searchitem.getActionView();
searchView.setQueryHint(Objects.requireNonNull(getContext()).getText(R.string.searchhint_productname));
super.onCreateOptionsMenu(menu, inflater);
}
}
adapter class
public class MyListAdapter extends BaseAdapter implements Filterable {
private List<Product> myList;
private List<Product> myListFull;
private LayoutInflater mInflater;
public MyListAdapter(List<Product> data, Context context) {
myList = data;
myList = new ArrayList(myList);
myListFull = new ArrayList(myList);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
return myList.size();
}
@Override
public Object getItem(int position) {
return myList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MyListAdapter.ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.listitem, parent, false);
holder = new MyListAdapter.ViewHolder();
holder.title = convertView.findViewById(R.id.listitem_title);
holder.description = convertView.findViewById(R.id.listitem_subtitle);
convertView.setTag(holder);
} else {
holder = (MyListAdapter.ViewHolder) convertView.getTag();
}
Product mProduct = (Product)getItem(position);
holder.title.setText(mProduct.getProductName());
holder.description.setText(mProduct.getProductDescription());
return convertView;
}
/**
* View holder
*/
static class ViewHolder {
private TextView title;
private TextView description;
}
@Override
public Filter getFilter() {
return exampleFilter;
}
private Filter exampleFilter = new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
List<Product> filteredList = new ArrayList<>();
if (constraint == null || constraint.length() == 0) {
filteredList.addAll(myListFull);
} else {
String filterPattern = constraint.toString().toLowerCase().trim();
for (Product item : myListFull) {
if (item.getProductName().toLowerCase().contains(filterPattern)) {
filteredList.add(item);
}
}
}
FilterResults results = new FilterResults();
results.values = filteredList;
return results;
}
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
myList.clear();
myList.addAll((List<Product>) results.values);
notifyDataSetChanged();
}
};
}
java android android-listview android-adapter android-listfragment
I'm trying to implement a SearchView
within a Toolbar
for a ListFragment
, but for some reason filtering is not working. The SearchView
and keyboard appear as normal, but the ListView
does not get filtered as I type something in.
fragment class
public class MyFragment extends ListFragment implements SearchView.OnQueryTextListener {
public MyFragment() {}
private ListView lv;
private MyListAdapter mAdapter;
public static MyFragment newInstance() {
return new MyFragment();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_list, container, false);
initialize();
return view;
}
List<Product> myList = new ArrayList<>();
private void initialize() {
String items = getActivity().getResources().getStringArray(R.array.product_names);
String itemDescriptions = getActivity().getResources().getStringArray(R.array.product_descriptions);
for (int n = 0; n < items.length; n++){
Product product = new Product();
product.setProductName(items[n]);
product.setProductDescription(itemDescriptions[n]);
myList.add(product);
}
mAdapter = new MyListAdapter(myList, getActivity());
setListAdapter(mAdapter);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
View v = getView();
mTwoPane = getActivity().findViewById(R.id.detail_container) != null;
assert v != null;
lv = v.findViewById(android.R.id.list);
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
MyListAdapter adapter = (MyListAdapter) parent.getAdapter();
}
});
super.onActivityCreated(savedInstanceState);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
MenuInflater mInflater = Objects.requireNonNull(getActivity()).getMenuInflater();
mInflater.inflate(R.menu.menu_search, menu);
MenuItem searchitem = menu.findItem(R.id.action_search);
SearchView searchView = (SearchView) searchitem.getActionView();
searchView.setQueryHint(Objects.requireNonNull(getContext()).getText(R.string.searchhint_productname));
super.onCreateOptionsMenu(menu, inflater);
}
}
adapter class
public class MyListAdapter extends BaseAdapter implements Filterable {
private List<Product> myList;
private List<Product> myListFull;
private LayoutInflater mInflater;
public MyListAdapter(List<Product> data, Context context) {
myList = data;
myList = new ArrayList(myList);
myListFull = new ArrayList(myList);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
return myList.size();
}
@Override
public Object getItem(int position) {
return myList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MyListAdapter.ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.listitem, parent, false);
holder = new MyListAdapter.ViewHolder();
holder.title = convertView.findViewById(R.id.listitem_title);
holder.description = convertView.findViewById(R.id.listitem_subtitle);
convertView.setTag(holder);
} else {
holder = (MyListAdapter.ViewHolder) convertView.getTag();
}
Product mProduct = (Product)getItem(position);
holder.title.setText(mProduct.getProductName());
holder.description.setText(mProduct.getProductDescription());
return convertView;
}
/**
* View holder
*/
static class ViewHolder {
private TextView title;
private TextView description;
}
@Override
public Filter getFilter() {
return exampleFilter;
}
private Filter exampleFilter = new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
List<Product> filteredList = new ArrayList<>();
if (constraint == null || constraint.length() == 0) {
filteredList.addAll(myListFull);
} else {
String filterPattern = constraint.toString().toLowerCase().trim();
for (Product item : myListFull) {
if (item.getProductName().toLowerCase().contains(filterPattern)) {
filteredList.add(item);
}
}
}
FilterResults results = new FilterResults();
results.values = filteredList;
return results;
}
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
myList.clear();
myList.addAll((List<Product>) results.values);
notifyDataSetChanged();
}
};
}
java android android-listview android-adapter android-listfragment
java android android-listview android-adapter android-listfragment
edited Nov 22 '18 at 0:12
MacaronLover
asked Nov 21 '18 at 22:59
MacaronLoverMacaronLover
2,09942761
2,09942761
1
You would need to callsetTextFilterEnabled(true)
on theListView
. However, if you check the documentation for that method, theAdapter
class you use must implement theFilterable
interface.
– Mike M.
Nov 21 '18 at 23:37
add a comment |
1
You would need to callsetTextFilterEnabled(true)
on theListView
. However, if you check the documentation for that method, theAdapter
class you use must implement theFilterable
interface.
– Mike M.
Nov 21 '18 at 23:37
1
1
You would need to call
setTextFilterEnabled(true)
on the ListView
. However, if you check the documentation for that method, the Adapter
class you use must implement the Filterable
interface.– Mike M.
Nov 21 '18 at 23:37
You would need to call
setTextFilterEnabled(true)
on the ListView
. However, if you check the documentation for that method, the Adapter
class you use must implement the Filterable
interface.– Mike M.
Nov 21 '18 at 23:37
add a comment |
1 Answer
1
active
oldest
votes
You're missing OnQueryTextListener
on your SearchView
, simply attach one so that the adapter knows when to filter:
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override public boolean onQueryTextSubmit(String query) {
return false;
}
@Override public boolean onQueryTextChange(String newText) {
mAdapter.getFilter().filter(newText);
return true;
}
});
1
I had this before and commented it out without realising that it would affect the filtering functionality, thanks.
– MacaronLover
Nov 22 '18 at 0:35
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53421639%2fsearchview-in-toolbar-not-filtering-listfragment%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You're missing OnQueryTextListener
on your SearchView
, simply attach one so that the adapter knows when to filter:
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override public boolean onQueryTextSubmit(String query) {
return false;
}
@Override public boolean onQueryTextChange(String newText) {
mAdapter.getFilter().filter(newText);
return true;
}
});
1
I had this before and commented it out without realising that it would affect the filtering functionality, thanks.
– MacaronLover
Nov 22 '18 at 0:35
add a comment |
You're missing OnQueryTextListener
on your SearchView
, simply attach one so that the adapter knows when to filter:
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override public boolean onQueryTextSubmit(String query) {
return false;
}
@Override public boolean onQueryTextChange(String newText) {
mAdapter.getFilter().filter(newText);
return true;
}
});
1
I had this before and commented it out without realising that it would affect the filtering functionality, thanks.
– MacaronLover
Nov 22 '18 at 0:35
add a comment |
You're missing OnQueryTextListener
on your SearchView
, simply attach one so that the adapter knows when to filter:
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override public boolean onQueryTextSubmit(String query) {
return false;
}
@Override public boolean onQueryTextChange(String newText) {
mAdapter.getFilter().filter(newText);
return true;
}
});
You're missing OnQueryTextListener
on your SearchView
, simply attach one so that the adapter knows when to filter:
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override public boolean onQueryTextSubmit(String query) {
return false;
}
@Override public boolean onQueryTextChange(String newText) {
mAdapter.getFilter().filter(newText);
return true;
}
});
answered Nov 22 '18 at 0:28
AaronAaron
1,8282213
1,8282213
1
I had this before and commented it out without realising that it would affect the filtering functionality, thanks.
– MacaronLover
Nov 22 '18 at 0:35
add a comment |
1
I had this before and commented it out without realising that it would affect the filtering functionality, thanks.
– MacaronLover
Nov 22 '18 at 0:35
1
1
I had this before and commented it out without realising that it would affect the filtering functionality, thanks.
– MacaronLover
Nov 22 '18 at 0:35
I had this before and commented it out without realising that it would affect the filtering functionality, thanks.
– MacaronLover
Nov 22 '18 at 0:35
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53421639%2fsearchview-in-toolbar-not-filtering-listfragment%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You would need to call
setTextFilterEnabled(true)
on theListView
. However, if you check the documentation for that method, theAdapter
class you use must implement theFilterable
interface.– Mike M.
Nov 21 '18 at 23:37