The project displays a list of images and text, but the image cannot be displayed because simpleadapter does not directly support this type of data.
Explanation of Android. widget. simpleadapter. viewbinder In the API:
This class can be used by external clients of simpleadapter to bind values to views. You shocould use this class to views that are not directly supported by simpleadapter or to change the way binding occurs
For views supported by simpleadapter.
So do some processing on simpleadapter
Adapter. setviewbinder (New viewbinder () {public Boolean setviewvalue (view, object data, string textrepresentation) {// determine whether it is the object we want to process if (view instanceof imageview & Data instanceof Bitmap) {imageview IV = (imageview) view; IV. setimagebitmap (Bitmap) data); Return true;} else return false ;}});
Simpleadapter constructor: simpleadapter (context, list <? Extends Map <string,?> Data, int resource, string [] From, int [])
Data: the processed data item, such as arraylist Object>
Resource: used layout file from: the Key of the map object, such as new
String [] {"usename", "imgurl"}, to: component ID, such as new
Int [] {
R. id. text_view_user_name, R. id. image_view_icon}); A listview consists of multiple list items. Each list item is provided by a hashmap object, and multiple list items are provided by the arraylist object.