Im trying to make a autocompletetext in android studio. When i put the coding and run the apps.Nothing happen! i take the source and make exactly like that still nothing happen.Maybe i do a some mistake in my code, because i'm beginner.
here is my code
package my.wedee.com.taskactivity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
public class MainActivity extends AppCompatActivity {
AutoCompleteTextView Airport;
String[] airport = {"India", "China", "Australia", "New Zealand", "England", "Pakistan"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//initiate an auto complete text view
Airport = (AutoCompleteTextView) findViewById(R.id.task_airport_list);
ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, airport);
Airport.setAdapter(adapter);
Airport.setThreshold(1);//start searching from 1 character
Airport.setAdapter(adapter); //set the adapter for displaying country name list
}
}
TQ
go to file and hit invalidate cache/restart , surely this will work ..