I show a listview from the following string:
String[] values = new String[] { test1, test2, test3 };
The variables:
private String test1 = "test";
private String test2 = "test";
private String test3 = "test3";
Now I don’t want to show the strings that contain “test” in my listview.
Like this:
if (String == "test") {
*don't show in ListView*;}
And I want it to test all Strings at once if they contain “test”
How is it possible?
EDIT: Here the adapter code:
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, values);
listView.setAdapter(adapter);
Yup…
OR
contains is a slow(er) string function though.
You might want to use an ArrayList though… that way you can just add all those objects to the array list, then iterate through it… and remove them as you go…
…Then set ‘arrayList’ (or whatever you’ve called it) as the string list for your adapter. If you use the same constructor it’ll look like this…