String[] friendList;
List<String> stockList = new ArrayList<String>();
for (Map.Entry<String, Object> entry : userList.entrySet()) {
stockList.add(entry.getKey());
}
String[] stockArr = new String[stockList.size()];
friendList = stockList.toArray(stockArr);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.select_dialog_singlechoice, friendList);
//Find TextView control
MaterialSearchBar searchBar = (MaterialSearchBar) findViewById(R.id.friendList);
LayoutInflater Xinflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
searchBar.setMaxSuggestionCount(10);
searchBar.setHint("Find a friend..");
CustomSuggestionsAdapter newAdapter = new CustomSuggestionsAdapter(Xinflater);
newAdapter.setSuggestions(stockList);
searchBar.setCustomSuggestionAdapter(newAdapter);
searchBar.addTextChangeListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
Log.d("LOG_TAG", getClass().getSimpleName() + " text changed " + searchBar.getText());
// send the entered text to our filter and let it manage everything
newAdapter.getFilter().filter(searchBar.getText());
}
@Override
public void afterTextChanged(Editable editable) {
}
});
Here is my code... the dropdown is NOT appearing. Pls help.
Here is my code... the dropdown is NOT appearing. Pls help.