• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps SimpleCursorAdapter problem

assistant

Lurker
Hi,

Selected data from SQLite database is placed in a cursor.

I have autocomplete textview in which I want to show only certain columns from cursor (e.g. first and last name).

I've managed to do that, but when I select an item from drop down list from autocomplete textview, it's not showing first and last name as a string (in a autocomplete textbox) but this:

android.database.sqlite.SQLiteCursor@43767ab8.

Code:
.....

Cursor cursor = db.query("tblUsers", null, null, null, null, null, null);
        
         
String[] from = new String[] { "name", "lastname" };
int[] to = new int[] { android.R.id.text1, android.R.id.text2};

textView = (AutoCompleteTextView) findViewById(R.id.autocomplete_users);
            
adapter = new SimpleCursorAdapter(this, android.R.layout.simple_dropdown_item_1line, cursor, from, to);
            
            
textView.setAdapter(adapter);

.....
How to solve this? Please help.

Thanks in advance!

Best regards,
I. F.
 
Back
Top Bottom