开发者

How to use simple_list_item_2 with android listview?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜