Title: How to create Auto Complete text in android
link : How to create Auto Complete text in android
How to create Auto Complete text in android
just drop auto-complete textview from widget to your layout or copy below code:
</LinearLayout>
Now open java file and paste below code
Now run your code..
android:layout_width="fill_ parent"
android:layout_height="fill_ parent"
android:orientation="vertical">
<AutoCompleteTextView
android:id="@+id/ autoCompleteTextView1"
android:layout_width="match_ parent"
android:layout_height="wrap_ content"
>
<requestFocus />
</AutoCompleteTextView>
Now open java file and paste below code
package sel.listG; //package name
import android.os.Bundle;
importandroid.widget.ArrayAdapter;
importandroid.widget. AutoCompleteTextView;
importandroid.app.Activity;
public class MainActivity extends Activity {
String values[]={"January", "July", "June", "Ravi", "Ravinder", "Abhishek", "Abhinav", "Harkishore", "Hardev"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate( savedInstanceState);
setContentView(R.layout.activi ty_main);
AutoCompleteTextView lv=(AutoCompleteTextView) findViewById(R.id.autoComplete TextView1);
//adapter will adapt the string and pass the string to lv object
ArrayAdapter<?> adapter=new ArrayAdapter<String>(this, android.R.layout.simple_list_ item_1, values);
lv.setAdapter(adapter);
}
}Now run your code..
That's How to create Auto Complete text in android
That's an article How to create Auto Complete text in android
This time, hopefully can benefit for you all. Well, see you in other article postings.
You are now reading the article How to create Auto Complete text in android With link address https://u-see1.blogspot.com/2017/06/how-to-create-auto-complete-text-in.html
Belum ada tanggapan untuk "How to create Auto Complete text in android"
Post a Comment