I'm creating an Android app in which there is a listeview and the search is filtered through an EditText.

What I want to know is how does Instagram (for example) show the preview of searches divided into categories?

Let me explain better, if on Instagram I look for example "London" I will come out in a list of fields where for example there is the city icon and with the word "London" next to it, underneath there is a field with "#london" written on it and another field with "London" and the user's photo below.

What are the names of the searches divided into categories or sections in "Programming"?

I would like to do it in my App but the problem is that I don't know how to call this thing.

If I have a listview and want to filter it through a search, while I type the word "London" it immediately shows me the Items with the same name as "London", instead I want a search like that of Instagram where the results are filtered first categories and then when you click on the category it shows you the results.

What is the name of this practice?

1 Answers

Community On Best Solutions

Use something like:

private ArrayAdapter<String> mAdapter;
private String[] data = {"myname","myname2","myname3","myname4","myname5"};
private EditText searchBox;
private ListView mListView;

public void onCreate(Bundle savedInstanceState) {

searchBox = findViewById(R.id.searchBox);
mListView = findViewById(R.id.mListView);


mAdapter = new ArrayAdapter<String>(MainActivity.this, 
android.R.layout.simple_list_item_1, data); 


searchBox.addTextChangedListener(new TextWatcher() {

public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
    // TODO Auto-generated method stub

public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
        int arg3) {
    // TODO Auto-generated method stub


public void afterTextChanged(Editable arg0) {
    // TODO Auto-generated method stub



Now if you enter "myname2" in the edittext, ListView will only show it. You can use the similar approach in case of GridView/RecyclerView.