My array is like {"Samsung Tab","Samsung Note","Samsung Galaxy","Samsung Galaxy Pro","Nokia Lumia","Nokia 5130","Sony Xperia"} some thing like that.i have edit text type GALAXY and click the button i have GO i want to show only Samsung Galaxy , Samsung Galaxy Pro in next activity list view.any know please help me.
There are some ways to do it, Here is one way ,you can create a custom method something like below.
public ArrayList<String> getSearchedItems(String searchString){
ArrayList<String> list = new ArrayList<String>();
for(int i = 0; i<array.length ;i++) { // array is the String array or list which contains all the Phone model names you want to search in.
if((array[i].toLowerCase()).contains(searchString.toLowerCase())) { // contains method will check if user enterred string is available in your Model names
list.add(array[i]);
}
}
return list; // list of strings/names containing search String.
}
Call this method in your go button press, or from next Activity. to get list of names.