1

It's surprising that I couldn't find anything on this subject. What's the method for generating a ListView on the fly when a '@' is detected in the EditText. Here's an example:

enter image description here

This is what I have so far:

 textfield.setOnEditorActionListener(new TextView.OnEditorActionListener() {
                @Override
                public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                    String newtext= textfield.getText().toString();
                    if(newtext.equals("@"))
                    {
                         //ListView with people need to appear
                    }
                    return false;
                }
            });

I know how to code the adapter, I need to display the ListView on the fly.

Jay
  • 4,873
  • 7
  • 72
  • 137

1 Answers1

1

This is probably an AutoCompleteTextView or a MultiAutoCompleteTextView.

And if rather than a fixed list you look this list up from the web or database (for example), I think you will need to provide a custom adapter that specifies a filter. See this https://stackoverflow.com/a/8784931/360211

Community
  • 1
  • 1
weston
  • 54,145
  • 21
  • 145
  • 203