1. Are you ready for the Galaxy S20? Here is everything we know so far!

Apps SimpleCursorAdapter problem

Discussion in 'Android Development' started by assistant, Feb 20, 2011.

  1. assistant

    assistant Lurker
    Thread Starter

    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 (Text):
    1.  
    2. .....
    3.  
    4. Cursor cursor = db.query("tblUsers", null, null, null, null, null, null);
    5.        
    6.          
    7. String[] from = new String[] { "name", "lastname" };
    8. int[] to = new int[] { android.R.id.text1, android.R.id.text2};
    9.  
    10. textView = (AutoCompleteTextView) findViewById(R.id.autocomplete_users);
    11.            
    12. adapter = new SimpleCursorAdapter(this, android.R.layout.simple_dropdown_item_1line, cursor, from, to);
    13.            
    14.            
    15. textView.setAdapter(adapter);
    16.  
    17. .....
    18.  
    19.  
    How to solve this? Please help.

    Thanks in advance!

    Best regards,
    I. F.
     

    Advertisement

Loading...
Similar Threads - SimpleCursorAdapter problem
  1. Spyros_B
    Replies:
    5
    Views:
    159
  2. JAMES31055
    Replies:
    1
    Views:
    119
  3. Rob
    Replies:
    10
    Views:
    73
  4. radimtr
    Replies:
    3
    Views:
    181
  5. KevinDP
    Replies:
    0
    Views:
    206
  6. Kishor Bapat
    Replies:
    1
    Views:
    128
  7. train7740
    Replies:
    1
    Views:
    118
  8. Timoth
    Replies:
    3
    Views:
    146
  9. Rgarner
    Replies:
    38
    Views:
    865
  10. moppliger1
    Replies:
    8
    Views:
    286

Share This Page

Loading...