Hi,
i have a problem with AutocompletetextView
i want to get id value from autocomplete that get data from sqlite
first i get data from sqlite and then i put the data to autocomplete
get data from db :
[code]
cursor = this.dbh.getallData("driver",
"driveridnya as _id,drivername as _username",
"driverstatus='0' and area='" + area + "' order
by drivername");
int totalDriverCursor = cursor.getCount();
[/code]
put the data from db into autocomplete
[code]
output = (TextView) findViewById(R.id.test);
output1 = (TextView) findViewById(R.id.test1);
// AutoComplete clockIn
acdata1 = (AutoCompleteTextView)
findViewById(R.id.completeClockIn);
if (totalDriverCursor != 0) {
cursor.moveToFirst();
String[] acContent = new String[totalDriverCursor];
int nilai = 0;
do {
String id = cursor.getString(0);
String drivername = cursor.getString(1);
acContent[nilai] = drivername;
nilai++;
} while (cursor.moveToNext());
dataAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line, acContent);
acdata1.setAdapter(dataAdapter);
}
[/code]
how to set id database and drivername database into autocomplete value
and get id from autocomplete when user click selected item ?
Thanks
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en