开发者

How to use simple_list_item_2 with android listview?

开发者 https://www.devze.com 2023-03-05 17:45 出处:网络
how did I have to extend my example to use a two line listview (for example read out the email from database)?

how did I have to extend my example to use a two line listview (for example read out the email from database)?

    ArrayList<String> db_results = new ArrayList<String>();
    Cursor c = db.rawQuery("SELECT lastname, firstname FROM contacts ORDER BY lastname",null);
    while(c.moveToNext()) {
        db_results.add(String.valueOf(c.getString(c.开发者_Go百科getColumnIndex("lastname"))) + ", " + String.valueOf(c.getString(c.getColumnIndex("firstname"))));
    }
    c.close();
    lv1.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,db_results));

Thanks ...

0

精彩评论

暂无评论...
验证码 换一张
取 消