I haven't done one of these with a SimpleCurosrAdapter, but I've worked through it with a Cursor/CursorAdapter. I just uploaded to the Developers group what I think is the minimum code for an AutoComplete with a Cursor/CursorAdapter.
It's here: http://groups.google.com/group/android-developers/browse_frm/thread/5d19c5dd3f28307d Hope it helps. On Mar 2, 4:49 pm, class_java <class_j...@yahoo.gr> wrote: > Hi All, > > I have a AutoCompleteTextView and I wont in the drop down list that > appears while typing to contain data from a database through > SimpleCursorAdapter. The drop down list appears, but there is not text > in it. When I click in the drop down item seems to work fine, the Text > is correctly shown in the AutoCompleteTextView. Please help... > > Code samples: > *************************************************************************************************************** > Activity: > final AutoCompleteTextView editTxt = (AutoCompleteTextView) > findViewById(R.id.foodedittext); > > mDbHelper = new DbHelper(this); > > Cursor cursor = mDbHelper.fetchAll(); > startManagingCursor(cursor); > int[] to = new int[]{android.R.layout.select_dialog_item}; > SimpleCursorAdapter cursAdapt = new SimpleCursorAdapter > (this,android.R.layout.simple_dropdown_item_1line,cursor,new String[] > {DbHelper.FOOD_NAME},to); > cursAdapt.setCursorToStringConverter(new CursorConverter()); > editTxt.setAdapter(cursAdapt); > ********************************************************************** > auto_complete.xml: > > <?xml version="1.0" encoding="utf-8"?> > > <TextView xmlns:android="http://schemas.android.com/apk/res/android" > android:id="@+id/auto_complete" > android:layout_height="wrap_content" > android:layout_width="wrap_content" > /> > > ************************************************************************* > public class CursorConverter implements CursorToStringConverter{ > > @Override > public CharSequence convertToString(Cursor cursor) { > String a = cursor.getString(1); > return a; > } > > } > > **************************************************************************** > > Thanks in advance... > Evelina --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---