Created
April 22, 2019 18:45
-
-
Save nitesh-singh-1307/a19c98e51584631dd4abb8f96768c325 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.demo.autocomplete; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.widget.ArrayAdapter; | |
import android.widget.AutoCompleteTextView; | |
public class MainActivity extends AppCompatActivity { | |
AutoCompleteTextView autoCompleteTextView; | |
String[] names = {"Rick","Amul","Samul","Denim","Lee"}; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
autoCompleteTextView = findViewById(R.id.autocomplete); | |
ArrayAdapter<String> adapter = new ArrayAdapter<>(this,R.layout.support_simple_spinner_dropdown_item,names); | |
autoCompleteTextView.setThreshold(2); | |
autoCompleteTextView.setAdapter(adapter); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment