简体   繁体   中英

Android SimpleCursorAdapter

I'm using a ListView a with SimpleCursorAdapter like this:

    final ListAdapter adapter = new SimpleCursorAdapter
            (this,android.R.layout.simple_list_item_1,c,new String[] {providerclass.tablename}, new int[] {R.id.listview1}); 

I'm not sure whether from is correct, what should I put in from?

When I put this it says URI not found.

Do like this:

String[] from = new String[] { "CUSTOMER" } // assuming your cursor have field "CUSTOMER"
int[] to = { android.R.id.text1 } // because android.R.layout.simple_list_item1 has such field

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM