I'm using elements of type AutoComplete in the project, so when the user types part of the text they are looking for, it presents the suggested options for it.
For this, I'm using the following snippet:
private void arrayAutoComplete() {
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_expandable_list_item_1, produto);
AutoCompleteTextView textView = (AutoCompleteTextView)
findViewById(R.id.editProduto);
textView.setAdapter(adapter);
}
private static final String[] produto = new String[]{
"Skol beats sensations", "Brahma", "Skol litrão", "Heinekein", "Skol 350 ml"
};
I want to know how to hide the smartphone's keyboard when the user selects one of the suggested texts.