I'm developing an android application in which I retrieve some piece of data ( all the village village names) from SQLite database table. I returned this via String Array. Code is
public String[] getAllVillage()
{
String[] villagelist=new String[2000];
int i=0;
Cursor c=sqLiteDatabase.rawQuery("SELECT * FROM " + MYDATABASE_TABLE2 ,null);
if (c.moveToFirst())
{
do
{
villagelist[i]=c.getString(1);
i++;
}while(c.moveToNext());
}
c.close();
return villagelist;
}
and, In my android application I passed this array into AutoCompleteTextview as following:
private SQLiteAdapterv vadapter;
String[] village=new String[2000];
String newone[] = new String[2000];
village=vadapter.getAllVillage();
for(int h=0;h<2000;h++)
{
newone[h]=village[h];
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_dropdown_item_1line,newone);
final AutoCompleteTextView acTextView = (AutoCompleteTextView)findViewById(R.id.autoCompleteTextView1);
acTextView.setThreshold(0);
acTextView.setAdapter(adapter);
acTextView.addTextChangedListener(this);
But the code has no effect which means, when I click the AutocompleteTextview, it won't show any villagenames. Is my method was correct? If not then help me to do this