开发者

how do I add an image to my listview in android?

开发者 https://www.devze.com 2023-02-16 17:21 出处:网络
I have a listview with 2 textviews inside of it that are filled by a database using the simple cursor adapter. I want to add an image inside each item in the list with the corresponding image from the

I have a listview with 2 textviews inside of it that are filled by a database using the simple cursor adapter. I want to add an image inside each item in the list with the corresponding image from the database. I have searched around about this topic but have yet to find a solution. any help would be greatly appreciated

String[] from = new String[]{InventoryDbAdapter.KEY_TITLE, InventoryDbAdapter.KEY_DESCRIPTION};

    // and an array of the fields we want to bind those fields to (in this case just text1)
    int[] to = new int[]{R.id.text1,R.id.text2};

    // Now create a simple cursor adapter and set it to display
    SimpleCursorAdapter inventory = 
        new SimpleCursorAdapter(this, R.layout.r开发者_JAVA技巧ow, InventoryCursor, from, to);
    setListAdapter(inventory

thanks


Really? Because a quick Google search turned up this blog entry which I think is the same one I used for my Android applications.

0

精彩评论

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