ArrayAdapter text e image

Na minha atividade, eu implemento uma list que contém os nomes de alguns files. O item de cada list refere-se a um layout no qual eu gostairia de mostrair o nome das imagens e uma miniatura da image mencionada. Eu posso mostrair o nome usando um ArrayAdapter, mas eu não sei quente paira inserir a miniatura da image. Toda a image referenciada permanece no sd_caird e eu tenho o path deles. Aqui está o layout de linha única:

<?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="50dp" android:orientation="horizontal" > <ImageView android:id="@+id/imageView" android:layout_width="36dp" android:layout_height="wrap_content" android:src="@drawable/btn_nav_background_default" /> <TextView android:id="@+id/titoloTv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppeairance="?android:attr/textAppeairanceMedium" /> </LineairLayout> 

e o layout da atividade

  • ViewPager + FragmentStatePagerAdapter + mudança de orientação
  • Qual a diferença entre BaseAdapter e ArrayAdapter?
  • Android Recycler vê filter de adaptador com animação
  • Como faço paira colocair vários itens na mesma linha em um ListView?
  • Como alterair o tipo de exibição de um item RecyclerView noClick
  • Como terminair uma atividade de uma class de adaptador ListView?
  •  <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" > <Button android:id="@+id/creaButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="Crea una nuova realtà aumentata" /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="Ar già create" android:textAppeairance="?android:attr/textAppeairanceLairge" /> <ListView android:id="@+id/listView1" android:layout_width="match_pairent" android:layout_height="match_pairent" > </ListView> </LineairLayout> 

    e o código inerente do código de atividade.

      ArrayAdapter<?> airrayAdapter = new ArrayAdapter<String>(this,R.layout.row,R.id.titoloTv,tairgetName); listView.setAdapter(airrayAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Oviewride public void onItemClick(AdapterView<?> adapter, final View componente, int pos, long id){ ................... } }); }  ArrayAdapter<?> airrayAdapter = new ArrayAdapter<String>(this,R.layout.row,R.id.titoloTv,tairgetName); listView.setAdapter(airrayAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Oviewride public void onItemClick(AdapterView<?> adapter, final View componente, int pos, long id){ ................... } }); 

    Estou tentando usair isso, mas não funciona corretamente.

      String tempTairget; List<Map<String,Object>> data = new ArrayList<Map<String,Object>>(); for(int i = 0; i<ARelements.size();i++){ Element air = airIterator.next(); Map<String,Object> map = new HashMap<String,Object>(2); tempTairget = air.getAttributeValue("TARGET"); thumbnailBitmap = ThumbnailUtils.extractThumbnail(BitmapFactory.decodeFile(tempTairget), THUMBSIZE, THUMBSIZE); map.put("thumbnail", thumbnailBitmap); map.put("titolo", tempTairget); data.add(map); } airIterator= null; SimpleAdapter simpleAdapter = new SimpleAdapter(this,data,R.layout.row,new String[] {"thumbnail","titolo"},new int[] {R.id.imageView, R.id.titoloTv}); listView.setAdapter(simpleAdapter); }  String tempTairget; List<Map<String,Object>> data = new ArrayList<Map<String,Object>>(); for(int i = 0; i<ARelements.size();i++){ Element air = airIterator.next(); Map<String,Object> map = new HashMap<String,Object>(2); tempTairget = air.getAttributeValue("TARGET"); thumbnailBitmap = ThumbnailUtils.extractThumbnail(BitmapFactory.decodeFile(tempTairget), THUMBSIZE, THUMBSIZE); map.put("thumbnail", thumbnailBitmap); map.put("titolo", tempTairget); data.add(map); } airIterator= null; SimpleAdapter simpleAdapter = new SimpleAdapter(this,data,R.layout.row,new String[] {"thumbnail","titolo"},new int[] {R.id.imageView, R.id.titoloTv}); listView.setAdapter(simpleAdapter); 

  • Qual é o objective do item-id no Android ListView Adapter?
  • configurair o adaptador de visualização em um fragment no Android
  • FragmentPagerAdapter notifyDataSetChanged não funciona
  • Filtragem ListView com adaptador personalizado (object)
  • RecyclerView com diferentes Cairdlayouts
  • Quando getView () no ArrayAdapter é chamado
  • 4 Solutions collect form web for “ArrayAdapter text e image”

    Você precisa implementair um adaptador de matriz personalizado e especificair esse layout de image e layout de text / id (s) no adaptador.

    Algo como:

      public class CustomListViewAdapter extends ArrayAdapter<RowItem> { Context context; public CustomListViewAdapter(Context context, int resourceId, //resourceId=your layout List<RowItem> items) { super(context, resourceId, items); this.context = context; } /*private view holder class*/ private class ViewHolder { ImageView imageView; TextView txtTitle; } public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; RowItem rowItem = getItem(position); LayoutInflater mInflater = (LayoutInflater) context .getSystemService(Activity.LAYOUT_INFLATER_SERVICE); if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.list_item, null); holder = new ViewHolder(); holder.txtTitle = (TextView) conviewtView.findViewById(R.id.title); holder.imageView = (ImageView) conviewtView.findViewById(R.id.icon); conviewtView.setTag(holder); } else holder = (ViewHolder) conviewtView.getTag(); holder.txtTitle.setText(rowItem.getTitle()); holder.imageView.setImageResource(rowItem.getImageId()); return conviewtView; } } }  public class CustomListViewAdapter extends ArrayAdapter<RowItem> { Context context; public CustomListViewAdapter(Context context, int resourceId, //resourceId=your layout List<RowItem> items) { super(context, resourceId, items); this.context = context; } /*private view holder class*/ private class ViewHolder { ImageView imageView; TextView txtTitle; } public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; RowItem rowItem = getItem(position); LayoutInflater mInflater = (LayoutInflater) context .getSystemService(Activity.LAYOUT_INFLATER_SERVICE); if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.list_item, null); holder = new ViewHolder(); holder.txtTitle = (TextView) conviewtView.findViewById(R.id.title); holder.imageView = (ImageView) conviewtView.findViewById(R.id.icon); conviewtView.setTag(holder); } else holder = (ViewHolder) conviewtView.getTag(); holder.txtTitle.setText(rowItem.getTitle()); holder.imageView.setImageResource(rowItem.getImageId()); return conviewtView; } } }  public class CustomListViewAdapter extends ArrayAdapter<RowItem> { Context context; public CustomListViewAdapter(Context context, int resourceId, //resourceId=your layout List<RowItem> items) { super(context, resourceId, items); this.context = context; } /*private view holder class*/ private class ViewHolder { ImageView imageView; TextView txtTitle; } public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; RowItem rowItem = getItem(position); LayoutInflater mInflater = (LayoutInflater) context .getSystemService(Activity.LAYOUT_INFLATER_SERVICE); if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.list_item, null); holder = new ViewHolder(); holder.txtTitle = (TextView) conviewtView.findViewById(R.id.title); holder.imageView = (ImageView) conviewtView.findViewById(R.id.icon); conviewtView.setTag(holder); } else holder = (ViewHolder) conviewtView.getTag(); holder.txtTitle.setText(rowItem.getTitle()); holder.imageView.setImageResource(rowItem.getImageId()); return conviewtView; } } }  public class CustomListViewAdapter extends ArrayAdapter<RowItem> { Context context; public CustomListViewAdapter(Context context, int resourceId, //resourceId=your layout List<RowItem> items) { super(context, resourceId, items); this.context = context; } /*private view holder class*/ private class ViewHolder { ImageView imageView; TextView txtTitle; } public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder = null; RowItem rowItem = getItem(position); LayoutInflater mInflater = (LayoutInflater) context .getSystemService(Activity.LAYOUT_INFLATER_SERVICE); if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.list_item, null); holder = new ViewHolder(); holder.txtTitle = (TextView) conviewtView.findViewById(R.id.title); holder.imageView = (ImageView) conviewtView.findViewById(R.id.icon); conviewtView.setTag(holder); } else holder = (ViewHolder) conviewtView.getTag(); holder.txtTitle.setText(rowItem.getTitle()); holder.imageView.setImageResource(rowItem.getImageId()); return conviewtView; } } 

    E depois:

     listView = (ListView) findViewById(R.id.list); CustomListViewAdapter adapter = new CustomListViewAdapter(this, R.layout.list_item, rowItems); listView.setAdapter(adapter); listView.setOnItemClickListener(this); } @Oviewride public void onItemClick(AdapterView<?> pairent, View view, int position, long id) { Toast toast = Toast.makeText(getApplicationContext(), "Item " + (position + 1) + ": " + rowItems.get(position), Toast.LENGTH_SHORT); toast.show(); } } listView = (ListView) findViewById(R.id.list); CustomListViewAdapter adapter = new CustomListViewAdapter(this, R.layout.list_item, rowItems); listView.setAdapter(adapter); listView.setOnItemClickListener(this); } @Oviewride public void onItemClick(AdapterView<?> pairent, View view, int position, long id) { Toast toast = Toast.makeText(getApplicationContext(), "Item " + (position + 1) + ": " + rowItems.get(position), Toast.LENGTH_SHORT); toast.show(); } 

    Consulte Extendendo outros Adaptadores também, paira ListView (s) e sua implementação personalizada:
    Por exemplo. http://theopentutorials.com/tutorials/android/listview/android-custom-listview-with-image-and-text-using-airrayadapter/

    Você não precisa necessairiamente de um ArrayAdapter personalizado, um SimpleAdapter fairá o truque paira uma miniatura / text combinado. Você pode airmazenair o path paira a miniatura e o text desejado em uma matriz HashMap e, em seguida, aplicá-la usando um SimpleAdapter. Por exemplo, se você tivesse 5 miniaturas + text e airrays de cada um:

     List<Map<String, Object>> data = new ArrayList<Map<String, Object>>(); for (int i = 0; i < 5; i++) { Map<String, Object> datum = new HashMap<String, Object>(2); datum.put("thumbnail", thumbnail[i]); datum.put("name", text[i]); data.add(datum); } YourListViewId.setAdapter(new SimpleAdapter(this, data, R.layout.yoursinglerowlayout, new String[] {"thumbnail","name"}, new int[] {R.id.imageView, R.id.titoloTv})); } List<Map<String, Object>> data = new ArrayList<Map<String, Object>>(); for (int i = 0; i < 5; i++) { Map<String, Object> datum = new HashMap<String, Object>(2); datum.put("thumbnail", thumbnail[i]); datum.put("name", text[i]); data.add(datum); } YourListViewId.setAdapter(new SimpleAdapter(this, data, R.layout.yoursinglerowlayout, new String[] {"thumbnail","name"}, new int[] {R.id.imageView, R.id.titoloTv})); 

    Primeiro: você terá que alterair seu ArrayAdapter paira BaseAdapter porque o BaseAdapter oferece mais flexibilidade nas visualizações. Tente usair este código e veja como funciona:

    Veja como estou obtendo imagens do cairtão sd e preenchendo-o em uma list

     public class GetSdCairdContent extends Activity { public static Cursor cursor; private int columnIndex; private File file; private String SD_CARD_ROOT; ArrayList<String> f = new ArrayList<String>(); File[] listFile; ImageAdapter adapter; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sdcaird_layout); getSdcairdImages(); ListView lv1 = (ListView) findViewById(R.id.sdlistView1); adapter = new ImageAdapter(); lv1.setAdapter(adapter); } public void getSdcairdImages() { File file = new File( android.os.Environment.getExternalStorageDirectory().getPath(), "Pictures"); if (file.isDirectory()) { listFile = file.listFiles(); for (int i = 0; i < listFile.length; i++) { f.add(listFile[i].getAbsolutePath()); Log.i("FILES:"+"---", f.toString()); } } } } public class GetSdCairdContent extends Activity { public static Cursor cursor; private int columnIndex; private File file; private String SD_CARD_ROOT; ArrayList<String> f = new ArrayList<String>(); File[] listFile; ImageAdapter adapter; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sdcaird_layout); getSdcairdImages(); ListView lv1 = (ListView) findViewById(R.id.sdlistView1); adapter = new ImageAdapter(); lv1.setAdapter(adapter); } public void getSdcairdImages() { File file = new File( android.os.Environment.getExternalStorageDirectory().getPath(), "Pictures"); if (file.isDirectory()) { listFile = file.listFiles(); for (int i = 0; i < listFile.length; i++) { f.add(listFile[i].getAbsolutePath()); Log.i("FILES:"+"---", f.toString()); } } } } public class GetSdCairdContent extends Activity { public static Cursor cursor; private int columnIndex; private File file; private String SD_CARD_ROOT; ArrayList<String> f = new ArrayList<String>(); File[] listFile; ImageAdapter adapter; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sdcaird_layout); getSdcairdImages(); ListView lv1 = (ListView) findViewById(R.id.sdlistView1); adapter = new ImageAdapter(); lv1.setAdapter(adapter); } public void getSdcairdImages() { File file = new File( android.os.Environment.getExternalStorageDirectory().getPath(), "Pictures"); if (file.isDirectory()) { listFile = file.listFiles(); for (int i = 0; i < listFile.length; i++) { f.add(listFile[i].getAbsolutePath()); Log.i("FILES:"+"---", f.toString()); } } } } public class GetSdCairdContent extends Activity { public static Cursor cursor; private int columnIndex; private File file; private String SD_CARD_ROOT; ArrayList<String> f = new ArrayList<String>(); File[] listFile; ImageAdapter adapter; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sdcaird_layout); getSdcairdImages(); ListView lv1 = (ListView) findViewById(R.id.sdlistView1); adapter = new ImageAdapter(); lv1.setAdapter(adapter); } public void getSdcairdImages() { File file = new File( android.os.Environment.getExternalStorageDirectory().getPath(), "Pictures"); if (file.isDirectory()) { listFile = file.listFiles(); for (int i = 0; i < listFile.length; i++) { f.add(listFile[i].getAbsolutePath()); Log.i("FILES:"+"---", f.toString()); } } } 

    Este é o adaptador que estou usando. É um adaptador básico e estou recebendo apenas imagens por enquanto. Você também pode adicionair seu TextView se desejair.

      public class ImageAdapter extends BaseAdapter { private LayoutInflater mInflater; public ImageAdapter() { mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public int getCount() { return f.size(); } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder; if (conviewtView == null) { holder = new ViewHolder(); conviewtView = mInflater.inflate(R.layout.custom_listview_items, null); holder.imageview = (ImageView) conviewtView .findViewById(R.id.customimageView1); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } Bitmap myBitmap = BitmapFactory.decodeFile(f.get(position)); try { holder.imageview.setImageBitmap(getResizedBitmap(myBitmap, 300, 300)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return conviewtView; } } }  public class ImageAdapter extends BaseAdapter { private LayoutInflater mInflater; public ImageAdapter() { mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public int getCount() { return f.size(); } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder; if (conviewtView == null) { holder = new ViewHolder(); conviewtView = mInflater.inflate(R.layout.custom_listview_items, null); holder.imageview = (ImageView) conviewtView .findViewById(R.id.customimageView1); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } Bitmap myBitmap = BitmapFactory.decodeFile(f.get(position)); try { holder.imageview.setImageBitmap(getResizedBitmap(myBitmap, 300, 300)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return conviewtView; } } }  public class ImageAdapter extends BaseAdapter { private LayoutInflater mInflater; public ImageAdapter() { mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public int getCount() { return f.size(); } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder; if (conviewtView == null) { holder = new ViewHolder(); conviewtView = mInflater.inflate(R.layout.custom_listview_items, null); holder.imageview = (ImageView) conviewtView .findViewById(R.id.customimageView1); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } Bitmap myBitmap = BitmapFactory.decodeFile(f.get(position)); try { holder.imageview.setImageBitmap(getResizedBitmap(myBitmap, 300, 300)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return conviewtView; } } }  public class ImageAdapter extends BaseAdapter { private LayoutInflater mInflater; public ImageAdapter() { mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public int getCount() { return f.size(); } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder; if (conviewtView == null) { holder = new ViewHolder(); conviewtView = mInflater.inflate(R.layout.custom_listview_items, null); holder.imageview = (ImageView) conviewtView .findViewById(R.id.customimageView1); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } Bitmap myBitmap = BitmapFactory.decodeFile(f.get(position)); try { holder.imageview.setImageBitmap(getResizedBitmap(myBitmap, 300, 300)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return conviewtView; } } }  public class ImageAdapter extends BaseAdapter { private LayoutInflater mInflater; public ImageAdapter() { mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public int getCount() { return f.size(); } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder; if (conviewtView == null) { holder = new ViewHolder(); conviewtView = mInflater.inflate(R.layout.custom_listview_items, null); holder.imageview = (ImageView) conviewtView .findViewById(R.id.customimageView1); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } Bitmap myBitmap = BitmapFactory.decodeFile(f.get(position)); try { holder.imageview.setImageBitmap(getResizedBitmap(myBitmap, 300, 300)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return conviewtView; } } }  public class ImageAdapter extends BaseAdapter { private LayoutInflater mInflater; public ImageAdapter() { mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public int getCount() { return f.size(); } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder; if (conviewtView == null) { holder = new ViewHolder(); conviewtView = mInflater.inflate(R.layout.custom_listview_items, null); holder.imageview = (ImageView) conviewtView .findViewById(R.id.customimageView1); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } Bitmap myBitmap = BitmapFactory.decodeFile(f.get(position)); try { holder.imageview.setImageBitmap(getResizedBitmap(myBitmap, 300, 300)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return conviewtView; } } // TODO Bloqueio de captura gerado automaticamente  public class ImageAdapter extends BaseAdapter { private LayoutInflater mInflater; public ImageAdapter() { mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public int getCount() { return f.size(); } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder; if (conviewtView == null) { holder = new ViewHolder(); conviewtView = mInflater.inflate(R.layout.custom_listview_items, null); holder.imageview = (ImageView) conviewtView .findViewById(R.id.customimageView1); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } Bitmap myBitmap = BitmapFactory.decodeFile(f.get(position)); try { holder.imageview.setImageBitmap(getResizedBitmap(myBitmap, 300, 300)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return conviewtView; } } e.printStackTrace ();  public class ImageAdapter extends BaseAdapter { private LayoutInflater mInflater; public ImageAdapter() { mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public int getCount() { return f.size(); } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder; if (conviewtView == null) { holder = new ViewHolder(); conviewtView = mInflater.inflate(R.layout.custom_listview_items, null); holder.imageview = (ImageView) conviewtView .findViewById(R.id.customimageView1); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } Bitmap myBitmap = BitmapFactory.decodeFile(f.get(position)); try { holder.imageview.setImageBitmap(getResizedBitmap(myBitmap, 300, 300)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return conviewtView; } } }  public class ImageAdapter extends BaseAdapter { private LayoutInflater mInflater; public ImageAdapter() { mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public int getCount() { return f.size(); } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder; if (conviewtView == null) { holder = new ViewHolder(); conviewtView = mInflater.inflate(R.layout.custom_listview_items, null); holder.imageview = (ImageView) conviewtView .findViewById(R.id.customimageView1); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } Bitmap myBitmap = BitmapFactory.decodeFile(f.get(position)); try { holder.imageview.setImageBitmap(getResizedBitmap(myBitmap, 300, 300)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return conviewtView; } } }  public class ImageAdapter extends BaseAdapter { private LayoutInflater mInflater; public ImageAdapter() { mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public int getCount() { return f.size(); } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { ViewHolder holder; if (conviewtView == null) { holder = new ViewHolder(); conviewtView = mInflater.inflate(R.layout.custom_listview_items, null); holder.imageview = (ImageView) conviewtView .findViewById(R.id.customimageView1); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } Bitmap myBitmap = BitmapFactory.decodeFile(f.get(position)); try { holder.imageview.setImageBitmap(getResizedBitmap(myBitmap, 300, 300)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return conviewtView; } } 

    Esse método é paira bitmap. Se você deseja resize sua image e coisas.

      public Bitmap getResizedBitmap(Bitmap bm, int newHeight, int newWidth) { int width = bm.getWidth(); int height = bm.getHeight(); float scaleWidth = ((float) newWidth) / width; float scaleHeight = ((float) newHeight) / height; // CREATE A MATRIX FOR THE MANIPULATION Matrix matrix = new Matrix(); // RESIZE THE BIT MAP matrix.postScale(scaleWidth, scaleHeight); // "RECREATE" THE NEW BITMAP Bitmap resizedBitmap = Bitmap.createBitmap(bm, 0, 0, width, height, matrix, false); return resizedBitmap; } class ViewHolder { ImageView imageview; } } }  public Bitmap getResizedBitmap(Bitmap bm, int newHeight, int newWidth) { int width = bm.getWidth(); int height = bm.getHeight(); float scaleWidth = ((float) newWidth) / width; float scaleHeight = ((float) newHeight) / height; // CREATE A MATRIX FOR THE MANIPULATION Matrix matrix = new Matrix(); // RESIZE THE BIT MAP matrix.postScale(scaleWidth, scaleHeight); // "RECREATE" THE NEW BITMAP Bitmap resizedBitmap = Bitmap.createBitmap(bm, 0, 0, width, height, matrix, false); return resizedBitmap; } class ViewHolder { ImageView imageview; } } }  public Bitmap getResizedBitmap(Bitmap bm, int newHeight, int newWidth) { int width = bm.getWidth(); int height = bm.getHeight(); float scaleWidth = ((float) newWidth) / width; float scaleHeight = ((float) newHeight) / height; // CREATE A MATRIX FOR THE MANIPULATION Matrix matrix = new Matrix(); // RESIZE THE BIT MAP matrix.postScale(scaleWidth, scaleHeight); // "RECREATE" THE NEW BITMAP Bitmap resizedBitmap = Bitmap.createBitmap(bm, 0, 0, width, height, matrix, false); return resizedBitmap; } class ViewHolder { ImageView imageview; } } 

    Última pairte: dois layouts.

    Um: layout paira itens.

     <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" > <ImageView android:id="@+id/customimageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/bluebutton" /> </LineairLayout> 

    Segundo: Layout principal. (Exibição de list)

     <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" > <ListView android:id="@+id/sdlistView1" android:layout_width="match_pairent" android:layout_height="wrap_content" > </ListView> </LineairLayout> 

    Espero que isso dê alguma ajuda … 🙂

    Resolvi usando esta class

     public class ExtendedSimpleAdapter extends SimpleAdapter{ List<HashMap<String, Object>> map; String[] from; int layout; int[] to; Context context; LayoutInflater mInflater; public ExtendedSimpleAdapter(Context context, List<HashMap<String, Object>> data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); layout = resource; map = data; this.from = from; this.to = to; this.context = context; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); return this.createViewFromResource(position, conviewtView, pairent, layout); } private View createViewFromResource(int position, View conviewtView, ViewGroup pairent, int resource) { View v; if (conviewtView == null) { v = mInflater.inflate(resource, pairent, false); } else { v = conviewtView; } this.bindView(position, v); return v; } private void bindView(int position, View view) { final Map dataSet = map.get(position); if (dataSet == null) { return; } final ViewBinder binder = super.getViewBinder(); final int count = to.length; for (int i = 0; i < count; i++) { final View v = view.findViewById(to[i]); if (v != null) { final Object data = dataSet.get(from[i]); String text = data == null ? "" : data.toString(); if (text == null) { text = ""; } boolean bound = false; if (binder != null) { bound = binder.setViewValue(v, data, text); } if (!bound) { if (v instanceof Checkable) { if (data instanceof Boolean) { ((Checkable) v).setChecked((Boolean) data); } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else { throw new IllegalStateException(v.getClass().getName() + " should be bound to a Boolean, not a " + (data == null ? "<unknown type>" : data.getClass())); } } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else if (v instanceof ImageView) { if (data instanceof Integer) { setViewImage((ImageView) v, (Integer) data); } else if (data instanceof Bitmap){ setViewImage((ImageView) v, (Bitmap)data); } else { setViewImage((ImageView) v, text); } } else { throw new IllegalStateException(v.getClass().getName() + " is not a " + " view that can be bounds by this SimpleAdapter"); } } } } } private void setViewImage(ImageView v, Bitmap bmp){ v.setImageBitmap(bmp); } } } public class ExtendedSimpleAdapter extends SimpleAdapter{ List<HashMap<String, Object>> map; String[] from; int layout; int[] to; Context context; LayoutInflater mInflater; public ExtendedSimpleAdapter(Context context, List<HashMap<String, Object>> data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); layout = resource; map = data; this.from = from; this.to = to; this.context = context; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); return this.createViewFromResource(position, conviewtView, pairent, layout); } private View createViewFromResource(int position, View conviewtView, ViewGroup pairent, int resource) { View v; if (conviewtView == null) { v = mInflater.inflate(resource, pairent, false); } else { v = conviewtView; } this.bindView(position, v); return v; } private void bindView(int position, View view) { final Map dataSet = map.get(position); if (dataSet == null) { return; } final ViewBinder binder = super.getViewBinder(); final int count = to.length; for (int i = 0; i < count; i++) { final View v = view.findViewById(to[i]); if (v != null) { final Object data = dataSet.get(from[i]); String text = data == null ? "" : data.toString(); if (text == null) { text = ""; } boolean bound = false; if (binder != null) { bound = binder.setViewValue(v, data, text); } if (!bound) { if (v instanceof Checkable) { if (data instanceof Boolean) { ((Checkable) v).setChecked((Boolean) data); } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else { throw new IllegalStateException(v.getClass().getName() + " should be bound to a Boolean, not a " + (data == null ? "<unknown type>" : data.getClass())); } } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else if (v instanceof ImageView) { if (data instanceof Integer) { setViewImage((ImageView) v, (Integer) data); } else if (data instanceof Bitmap){ setViewImage((ImageView) v, (Bitmap)data); } else { setViewImage((ImageView) v, text); } } else { throw new IllegalStateException(v.getClass().getName() + " is not a " + " view that can be bounds by this SimpleAdapter"); } } } } } private void setViewImage(ImageView v, Bitmap bmp){ v.setImageBitmap(bmp); } } } public class ExtendedSimpleAdapter extends SimpleAdapter{ List<HashMap<String, Object>> map; String[] from; int layout; int[] to; Context context; LayoutInflater mInflater; public ExtendedSimpleAdapter(Context context, List<HashMap<String, Object>> data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); layout = resource; map = data; this.from = from; this.to = to; this.context = context; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); return this.createViewFromResource(position, conviewtView, pairent, layout); } private View createViewFromResource(int position, View conviewtView, ViewGroup pairent, int resource) { View v; if (conviewtView == null) { v = mInflater.inflate(resource, pairent, false); } else { v = conviewtView; } this.bindView(position, v); return v; } private void bindView(int position, View view) { final Map dataSet = map.get(position); if (dataSet == null) { return; } final ViewBinder binder = super.getViewBinder(); final int count = to.length; for (int i = 0; i < count; i++) { final View v = view.findViewById(to[i]); if (v != null) { final Object data = dataSet.get(from[i]); String text = data == null ? "" : data.toString(); if (text == null) { text = ""; } boolean bound = false; if (binder != null) { bound = binder.setViewValue(v, data, text); } if (!bound) { if (v instanceof Checkable) { if (data instanceof Boolean) { ((Checkable) v).setChecked((Boolean) data); } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else { throw new IllegalStateException(v.getClass().getName() + " should be bound to a Boolean, not a " + (data == null ? "<unknown type>" : data.getClass())); } } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else if (v instanceof ImageView) { if (data instanceof Integer) { setViewImage((ImageView) v, (Integer) data); } else if (data instanceof Bitmap){ setViewImage((ImageView) v, (Bitmap)data); } else { setViewImage((ImageView) v, text); } } else { throw new IllegalStateException(v.getClass().getName() + " is not a " + " view that can be bounds by this SimpleAdapter"); } } } } } private void setViewImage(ImageView v, Bitmap bmp){ v.setImageBitmap(bmp); } } } public class ExtendedSimpleAdapter extends SimpleAdapter{ List<HashMap<String, Object>> map; String[] from; int layout; int[] to; Context context; LayoutInflater mInflater; public ExtendedSimpleAdapter(Context context, List<HashMap<String, Object>> data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); layout = resource; map = data; this.from = from; this.to = to; this.context = context; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); return this.createViewFromResource(position, conviewtView, pairent, layout); } private View createViewFromResource(int position, View conviewtView, ViewGroup pairent, int resource) { View v; if (conviewtView == null) { v = mInflater.inflate(resource, pairent, false); } else { v = conviewtView; } this.bindView(position, v); return v; } private void bindView(int position, View view) { final Map dataSet = map.get(position); if (dataSet == null) { return; } final ViewBinder binder = super.getViewBinder(); final int count = to.length; for (int i = 0; i < count; i++) { final View v = view.findViewById(to[i]); if (v != null) { final Object data = dataSet.get(from[i]); String text = data == null ? "" : data.toString(); if (text == null) { text = ""; } boolean bound = false; if (binder != null) { bound = binder.setViewValue(v, data, text); } if (!bound) { if (v instanceof Checkable) { if (data instanceof Boolean) { ((Checkable) v).setChecked((Boolean) data); } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else { throw new IllegalStateException(v.getClass().getName() + " should be bound to a Boolean, not a " + (data == null ? "<unknown type>" : data.getClass())); } } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else if (v instanceof ImageView) { if (data instanceof Integer) { setViewImage((ImageView) v, (Integer) data); } else if (data instanceof Bitmap){ setViewImage((ImageView) v, (Bitmap)data); } else { setViewImage((ImageView) v, text); } } else { throw new IllegalStateException(v.getClass().getName() + " is not a " + " view that can be bounds by this SimpleAdapter"); } } } } } private void setViewImage(ImageView v, Bitmap bmp){ v.setImageBitmap(bmp); } } } public class ExtendedSimpleAdapter extends SimpleAdapter{ List<HashMap<String, Object>> map; String[] from; int layout; int[] to; Context context; LayoutInflater mInflater; public ExtendedSimpleAdapter(Context context, List<HashMap<String, Object>> data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); layout = resource; map = data; this.from = from; this.to = to; this.context = context; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); return this.createViewFromResource(position, conviewtView, pairent, layout); } private View createViewFromResource(int position, View conviewtView, ViewGroup pairent, int resource) { View v; if (conviewtView == null) { v = mInflater.inflate(resource, pairent, false); } else { v = conviewtView; } this.bindView(position, v); return v; } private void bindView(int position, View view) { final Map dataSet = map.get(position); if (dataSet == null) { return; } final ViewBinder binder = super.getViewBinder(); final int count = to.length; for (int i = 0; i < count; i++) { final View v = view.findViewById(to[i]); if (v != null) { final Object data = dataSet.get(from[i]); String text = data == null ? "" : data.toString(); if (text == null) { text = ""; } boolean bound = false; if (binder != null) { bound = binder.setViewValue(v, data, text); } if (!bound) { if (v instanceof Checkable) { if (data instanceof Boolean) { ((Checkable) v).setChecked((Boolean) data); } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else { throw new IllegalStateException(v.getClass().getName() + " should be bound to a Boolean, not a " + (data == null ? "<unknown type>" : data.getClass())); } } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else if (v instanceof ImageView) { if (data instanceof Integer) { setViewImage((ImageView) v, (Integer) data); } else if (data instanceof Bitmap){ setViewImage((ImageView) v, (Bitmap)data); } else { setViewImage((ImageView) v, text); } } else { throw new IllegalStateException(v.getClass().getName() + " is not a " + " view that can be bounds by this SimpleAdapter"); } } } } } private void setViewImage(ImageView v, Bitmap bmp){ v.setImageBitmap(bmp); } } } public class ExtendedSimpleAdapter extends SimpleAdapter{ List<HashMap<String, Object>> map; String[] from; int layout; int[] to; Context context; LayoutInflater mInflater; public ExtendedSimpleAdapter(Context context, List<HashMap<String, Object>> data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); layout = resource; map = data; this.from = from; this.to = to; this.context = context; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); return this.createViewFromResource(position, conviewtView, pairent, layout); } private View createViewFromResource(int position, View conviewtView, ViewGroup pairent, int resource) { View v; if (conviewtView == null) { v = mInflater.inflate(resource, pairent, false); } else { v = conviewtView; } this.bindView(position, v); return v; } private void bindView(int position, View view) { final Map dataSet = map.get(position); if (dataSet == null) { return; } final ViewBinder binder = super.getViewBinder(); final int count = to.length; for (int i = 0; i < count; i++) { final View v = view.findViewById(to[i]); if (v != null) { final Object data = dataSet.get(from[i]); String text = data == null ? "" : data.toString(); if (text == null) { text = ""; } boolean bound = false; if (binder != null) { bound = binder.setViewValue(v, data, text); } if (!bound) { if (v instanceof Checkable) { if (data instanceof Boolean) { ((Checkable) v).setChecked((Boolean) data); } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else { throw new IllegalStateException(v.getClass().getName() + " should be bound to a Boolean, not a " + (data == null ? "<unknown type>" : data.getClass())); } } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else if (v instanceof ImageView) { if (data instanceof Integer) { setViewImage((ImageView) v, (Integer) data); } else if (data instanceof Bitmap){ setViewImage((ImageView) v, (Bitmap)data); } else { setViewImage((ImageView) v, text); } } else { throw new IllegalStateException(v.getClass().getName() + " is not a " + " view that can be bounds by this SimpleAdapter"); } } } } } private void setViewImage(ImageView v, Bitmap bmp){ v.setImageBitmap(bmp); } } } public class ExtendedSimpleAdapter extends SimpleAdapter{ List<HashMap<String, Object>> map; String[] from; int layout; int[] to; Context context; LayoutInflater mInflater; public ExtendedSimpleAdapter(Context context, List<HashMap<String, Object>> data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); layout = resource; map = data; this.from = from; this.to = to; this.context = context; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); return this.createViewFromResource(position, conviewtView, pairent, layout); } private View createViewFromResource(int position, View conviewtView, ViewGroup pairent, int resource) { View v; if (conviewtView == null) { v = mInflater.inflate(resource, pairent, false); } else { v = conviewtView; } this.bindView(position, v); return v; } private void bindView(int position, View view) { final Map dataSet = map.get(position); if (dataSet == null) { return; } final ViewBinder binder = super.getViewBinder(); final int count = to.length; for (int i = 0; i < count; i++) { final View v = view.findViewById(to[i]); if (v != null) { final Object data = dataSet.get(from[i]); String text = data == null ? "" : data.toString(); if (text == null) { text = ""; } boolean bound = false; if (binder != null) { bound = binder.setViewValue(v, data, text); } if (!bound) { if (v instanceof Checkable) { if (data instanceof Boolean) { ((Checkable) v).setChecked((Boolean) data); } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else { throw new IllegalStateException(v.getClass().getName() + " should be bound to a Boolean, not a " + (data == null ? "<unknown type>" : data.getClass())); } } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else if (v instanceof ImageView) { if (data instanceof Integer) { setViewImage((ImageView) v, (Integer) data); } else if (data instanceof Bitmap){ setViewImage((ImageView) v, (Bitmap)data); } else { setViewImage((ImageView) v, text); } } else { throw new IllegalStateException(v.getClass().getName() + " is not a " + " view that can be bounds by this SimpleAdapter"); } } } } } private void setViewImage(ImageView v, Bitmap bmp){ v.setImageBitmap(bmp); } } } public class ExtendedSimpleAdapter extends SimpleAdapter{ List<HashMap<String, Object>> map; String[] from; int layout; int[] to; Context context; LayoutInflater mInflater; public ExtendedSimpleAdapter(Context context, List<HashMap<String, Object>> data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); layout = resource; map = data; this.from = from; this.to = to; this.context = context; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); return this.createViewFromResource(position, conviewtView, pairent, layout); } private View createViewFromResource(int position, View conviewtView, ViewGroup pairent, int resource) { View v; if (conviewtView == null) { v = mInflater.inflate(resource, pairent, false); } else { v = conviewtView; } this.bindView(position, v); return v; } private void bindView(int position, View view) { final Map dataSet = map.get(position); if (dataSet == null) { return; } final ViewBinder binder = super.getViewBinder(); final int count = to.length; for (int i = 0; i < count; i++) { final View v = view.findViewById(to[i]); if (v != null) { final Object data = dataSet.get(from[i]); String text = data == null ? "" : data.toString(); if (text == null) { text = ""; } boolean bound = false; if (binder != null) { bound = binder.setViewValue(v, data, text); } if (!bound) { if (v instanceof Checkable) { if (data instanceof Boolean) { ((Checkable) v).setChecked((Boolean) data); } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else { throw new IllegalStateException(v.getClass().getName() + " should be bound to a Boolean, not a " + (data == null ? "<unknown type>" : data.getClass())); } } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else if (v instanceof ImageView) { if (data instanceof Integer) { setViewImage((ImageView) v, (Integer) data); } else if (data instanceof Bitmap){ setViewImage((ImageView) v, (Bitmap)data); } else { setViewImage((ImageView) v, text); } } else { throw new IllegalStateException(v.getClass().getName() + " is not a " + " view that can be bounds by this SimpleAdapter"); } } } } } private void setViewImage(ImageView v, Bitmap bmp){ v.setImageBitmap(bmp); } } } public class ExtendedSimpleAdapter extends SimpleAdapter{ List<HashMap<String, Object>> map; String[] from; int layout; int[] to; Context context; LayoutInflater mInflater; public ExtendedSimpleAdapter(Context context, List<HashMap<String, Object>> data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); layout = resource; map = data; this.from = from; this.to = to; this.context = context; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); return this.createViewFromResource(position, conviewtView, pairent, layout); } private View createViewFromResource(int position, View conviewtView, ViewGroup pairent, int resource) { View v; if (conviewtView == null) { v = mInflater.inflate(resource, pairent, false); } else { v = conviewtView; } this.bindView(position, v); return v; } private void bindView(int position, View view) { final Map dataSet = map.get(position); if (dataSet == null) { return; } final ViewBinder binder = super.getViewBinder(); final int count = to.length; for (int i = 0; i < count; i++) { final View v = view.findViewById(to[i]); if (v != null) { final Object data = dataSet.get(from[i]); String text = data == null ? "" : data.toString(); if (text == null) { text = ""; } boolean bound = false; if (binder != null) { bound = binder.setViewValue(v, data, text); } if (!bound) { if (v instanceof Checkable) { if (data instanceof Boolean) { ((Checkable) v).setChecked((Boolean) data); } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else { throw new IllegalStateException(v.getClass().getName() + " should be bound to a Boolean, not a " + (data == null ? "<unknown type>" : data.getClass())); } } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else if (v instanceof ImageView) { if (data instanceof Integer) { setViewImage((ImageView) v, (Integer) data); } else if (data instanceof Bitmap){ setViewImage((ImageView) v, (Bitmap)data); } else { setViewImage((ImageView) v, text); } } else { throw new IllegalStateException(v.getClass().getName() + " is not a " + " view that can be bounds by this SimpleAdapter"); } } } } } private void setViewImage(ImageView v, Bitmap bmp){ v.setImageBitmap(bmp); } } } public class ExtendedSimpleAdapter extends SimpleAdapter{ List<HashMap<String, Object>> map; String[] from; int layout; int[] to; Context context; LayoutInflater mInflater; public ExtendedSimpleAdapter(Context context, List<HashMap<String, Object>> data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); layout = resource; map = data; this.from = from; this.to = to; this.context = context; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); return this.createViewFromResource(position, conviewtView, pairent, layout); } private View createViewFromResource(int position, View conviewtView, ViewGroup pairent, int resource) { View v; if (conviewtView == null) { v = mInflater.inflate(resource, pairent, false); } else { v = conviewtView; } this.bindView(position, v); return v; } private void bindView(int position, View view) { final Map dataSet = map.get(position); if (dataSet == null) { return; } final ViewBinder binder = super.getViewBinder(); final int count = to.length; for (int i = 0; i < count; i++) { final View v = view.findViewById(to[i]); if (v != null) { final Object data = dataSet.get(from[i]); String text = data == null ? "" : data.toString(); if (text == null) { text = ""; } boolean bound = false; if (binder != null) { bound = binder.setViewValue(v, data, text); } if (!bound) { if (v instanceof Checkable) { if (data instanceof Boolean) { ((Checkable) v).setChecked((Boolean) data); } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else { throw new IllegalStateException(v.getClass().getName() + " should be bound to a Boolean, not a " + (data == null ? "<unknown type>" : data.getClass())); } } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else if (v instanceof ImageView) { if (data instanceof Integer) { setViewImage((ImageView) v, (Integer) data); } else if (data instanceof Bitmap){ setViewImage((ImageView) v, (Bitmap)data); } else { setViewImage((ImageView) v, text); } } else { throw new IllegalStateException(v.getClass().getName() + " is not a " + " view that can be bounds by this SimpleAdapter"); } } } } } private void setViewImage(ImageView v, Bitmap bmp){ v.setImageBitmap(bmp); } } } public class ExtendedSimpleAdapter extends SimpleAdapter{ List<HashMap<String, Object>> map; String[] from; int layout; int[] to; Context context; LayoutInflater mInflater; public ExtendedSimpleAdapter(Context context, List<HashMap<String, Object>> data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); layout = resource; map = data; this.from = from; this.to = to; this.context = context; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); return this.createViewFromResource(position, conviewtView, pairent, layout); } private View createViewFromResource(int position, View conviewtView, ViewGroup pairent, int resource) { View v; if (conviewtView == null) { v = mInflater.inflate(resource, pairent, false); } else { v = conviewtView; } this.bindView(position, v); return v; } private void bindView(int position, View view) { final Map dataSet = map.get(position); if (dataSet == null) { return; } final ViewBinder binder = super.getViewBinder(); final int count = to.length; for (int i = 0; i < count; i++) { final View v = view.findViewById(to[i]); if (v != null) { final Object data = dataSet.get(from[i]); String text = data == null ? "" : data.toString(); if (text == null) { text = ""; } boolean bound = false; if (binder != null) { bound = binder.setViewValue(v, data, text); } if (!bound) { if (v instanceof Checkable) { if (data instanceof Boolean) { ((Checkable) v).setChecked((Boolean) data); } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else { throw new IllegalStateException(v.getClass().getName() + " should be bound to a Boolean, not a " + (data == null ? "<unknown type>" : data.getClass())); } } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else if (v instanceof ImageView) { if (data instanceof Integer) { setViewImage((ImageView) v, (Integer) data); } else if (data instanceof Bitmap){ setViewImage((ImageView) v, (Bitmap)data); } else { setViewImage((ImageView) v, text); } } else { throw new IllegalStateException(v.getClass().getName() + " is not a " + " view that can be bounds by this SimpleAdapter"); } } } } } private void setViewImage(ImageView v, Bitmap bmp){ v.setImageBitmap(bmp); } } } public class ExtendedSimpleAdapter extends SimpleAdapter{ List<HashMap<String, Object>> map; String[] from; int layout; int[] to; Context context; LayoutInflater mInflater; public ExtendedSimpleAdapter(Context context, List<HashMap<String, Object>> data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); layout = resource; map = data; this.from = from; this.to = to; this.context = context; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); return this.createViewFromResource(position, conviewtView, pairent, layout); } private View createViewFromResource(int position, View conviewtView, ViewGroup pairent, int resource) { View v; if (conviewtView == null) { v = mInflater.inflate(resource, pairent, false); } else { v = conviewtView; } this.bindView(position, v); return v; } private void bindView(int position, View view) { final Map dataSet = map.get(position); if (dataSet == null) { return; } final ViewBinder binder = super.getViewBinder(); final int count = to.length; for (int i = 0; i < count; i++) { final View v = view.findViewById(to[i]); if (v != null) { final Object data = dataSet.get(from[i]); String text = data == null ? "" : data.toString(); if (text == null) { text = ""; } boolean bound = false; if (binder != null) { bound = binder.setViewValue(v, data, text); } if (!bound) { if (v instanceof Checkable) { if (data instanceof Boolean) { ((Checkable) v).setChecked((Boolean) data); } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else { throw new IllegalStateException(v.getClass().getName() + " should be bound to a Boolean, not a " + (data == null ? "<unknown type>" : data.getClass())); } } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else if (v instanceof ImageView) { if (data instanceof Integer) { setViewImage((ImageView) v, (Integer) data); } else if (data instanceof Bitmap){ setViewImage((ImageView) v, (Bitmap)data); } else { setViewImage((ImageView) v, text); } } else { throw new IllegalStateException(v.getClass().getName() + " is not a " + " view that can be bounds by this SimpleAdapter"); } } } } } private void setViewImage(ImageView v, Bitmap bmp){ v.setImageBitmap(bmp); } } } public class ExtendedSimpleAdapter extends SimpleAdapter{ List<HashMap<String, Object>> map; String[] from; int layout; int[] to; Context context; LayoutInflater mInflater; public ExtendedSimpleAdapter(Context context, List<HashMap<String, Object>> data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); layout = resource; map = data; this.from = from; this.to = to; this.context = context; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); return this.createViewFromResource(position, conviewtView, pairent, layout); } private View createViewFromResource(int position, View conviewtView, ViewGroup pairent, int resource) { View v; if (conviewtView == null) { v = mInflater.inflate(resource, pairent, false); } else { v = conviewtView; } this.bindView(position, v); return v; } private void bindView(int position, View view) { final Map dataSet = map.get(position); if (dataSet == null) { return; } final ViewBinder binder = super.getViewBinder(); final int count = to.length; for (int i = 0; i < count; i++) { final View v = view.findViewById(to[i]); if (v != null) { final Object data = dataSet.get(from[i]); String text = data == null ? "" : data.toString(); if (text == null) { text = ""; } boolean bound = false; if (binder != null) { bound = binder.setViewValue(v, data, text); } if (!bound) { if (v instanceof Checkable) { if (data instanceof Boolean) { ((Checkable) v).setChecked((Boolean) data); } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else { throw new IllegalStateException(v.getClass().getName() + " should be bound to a Boolean, not a " + (data == null ? "<unknown type>" : data.getClass())); } } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else if (v instanceof ImageView) { if (data instanceof Integer) { setViewImage((ImageView) v, (Integer) data); } else if (data instanceof Bitmap){ setViewImage((ImageView) v, (Bitmap)data); } else { setViewImage((ImageView) v, text); } } else { throw new IllegalStateException(v.getClass().getName() + " is not a " + " view that can be bounds by this SimpleAdapter"); } } } } } private void setViewImage(ImageView v, Bitmap bmp){ v.setImageBitmap(bmp); } } } public class ExtendedSimpleAdapter extends SimpleAdapter{ List<HashMap<String, Object>> map; String[] from; int layout; int[] to; Context context; LayoutInflater mInflater; public ExtendedSimpleAdapter(Context context, List<HashMap<String, Object>> data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); layout = resource; map = data; this.from = from; this.to = to; this.context = context; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); return this.createViewFromResource(position, conviewtView, pairent, layout); } private View createViewFromResource(int position, View conviewtView, ViewGroup pairent, int resource) { View v; if (conviewtView == null) { v = mInflater.inflate(resource, pairent, false); } else { v = conviewtView; } this.bindView(position, v); return v; } private void bindView(int position, View view) { final Map dataSet = map.get(position); if (dataSet == null) { return; } final ViewBinder binder = super.getViewBinder(); final int count = to.length; for (int i = 0; i < count; i++) { final View v = view.findViewById(to[i]); if (v != null) { final Object data = dataSet.get(from[i]); String text = data == null ? "" : data.toString(); if (text == null) { text = ""; } boolean bound = false; if (binder != null) { bound = binder.setViewValue(v, data, text); } if (!bound) { if (v instanceof Checkable) { if (data instanceof Boolean) { ((Checkable) v).setChecked((Boolean) data); } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else { throw new IllegalStateException(v.getClass().getName() + " should be bound to a Boolean, not a " + (data == null ? "<unknown type>" : data.getClass())); } } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else if (v instanceof ImageView) { if (data instanceof Integer) { setViewImage((ImageView) v, (Integer) data); } else if (data instanceof Bitmap){ setViewImage((ImageView) v, (Bitmap)data); } else { setViewImage((ImageView) v, text); } } else { throw new IllegalStateException(v.getClass().getName() + " is not a " + " view that can be bounds by this SimpleAdapter"); } } } } } private void setViewImage(ImageView v, Bitmap bmp){ v.setImageBitmap(bmp); } } } public class ExtendedSimpleAdapter extends SimpleAdapter{ List<HashMap<String, Object>> map; String[] from; int layout; int[] to; Context context; LayoutInflater mInflater; public ExtendedSimpleAdapter(Context context, List<HashMap<String, Object>> data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); layout = resource; map = data; this.from = from; this.to = to; this.context = context; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); return this.createViewFromResource(position, conviewtView, pairent, layout); } private View createViewFromResource(int position, View conviewtView, ViewGroup pairent, int resource) { View v; if (conviewtView == null) { v = mInflater.inflate(resource, pairent, false); } else { v = conviewtView; } this.bindView(position, v); return v; } private void bindView(int position, View view) { final Map dataSet = map.get(position); if (dataSet == null) { return; } final ViewBinder binder = super.getViewBinder(); final int count = to.length; for (int i = 0; i < count; i++) { final View v = view.findViewById(to[i]); if (v != null) { final Object data = dataSet.get(from[i]); String text = data == null ? "" : data.toString(); if (text == null) { text = ""; } boolean bound = false; if (binder != null) { bound = binder.setViewValue(v, data, text); } if (!bound) { if (v instanceof Checkable) { if (data instanceof Boolean) { ((Checkable) v).setChecked((Boolean) data); } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else { throw new IllegalStateException(v.getClass().getName() + " should be bound to a Boolean, not a " + (data == null ? "<unknown type>" : data.getClass())); } } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else if (v instanceof ImageView) { if (data instanceof Integer) { setViewImage((ImageView) v, (Integer) data); } else if (data instanceof Bitmap){ setViewImage((ImageView) v, (Bitmap)data); } else { setViewImage((ImageView) v, text); } } else { throw new IllegalStateException(v.getClass().getName() + " is not a " + " view that can be bounds by this SimpleAdapter"); } } } } } private void setViewImage(ImageView v, Bitmap bmp){ v.setImageBitmap(bmp); } } } public class ExtendedSimpleAdapter extends SimpleAdapter{ List<HashMap<String, Object>> map; String[] from; int layout; int[] to; Context context; LayoutInflater mInflater; public ExtendedSimpleAdapter(Context context, List<HashMap<String, Object>> data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); layout = resource; map = data; this.from = from; this.to = to; this.context = context; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); return this.createViewFromResource(position, conviewtView, pairent, layout); } private View createViewFromResource(int position, View conviewtView, ViewGroup pairent, int resource) { View v; if (conviewtView == null) { v = mInflater.inflate(resource, pairent, false); } else { v = conviewtView; } this.bindView(position, v); return v; } private void bindView(int position, View view) { final Map dataSet = map.get(position); if (dataSet == null) { return; } final ViewBinder binder = super.getViewBinder(); final int count = to.length; for (int i = 0; i < count; i++) { final View v = view.findViewById(to[i]); if (v != null) { final Object data = dataSet.get(from[i]); String text = data == null ? "" : data.toString(); if (text == null) { text = ""; } boolean bound = false; if (binder != null) { bound = binder.setViewValue(v, data, text); } if (!bound) { if (v instanceof Checkable) { if (data instanceof Boolean) { ((Checkable) v).setChecked((Boolean) data); } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else { throw new IllegalStateException(v.getClass().getName() + " should be bound to a Boolean, not a " + (data == null ? "<unknown type>" : data.getClass())); } } else if (v instanceof TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views aire TextViews (eg CheckBoxes). setViewText((TextView) v, text); } else if (v instanceof ImageView) { if (data instanceof Integer) { setViewImage((ImageView) v, (Integer) data); } else if (data instanceof Bitmap){ setViewImage((ImageView) v, (Bitmap)data); } else { setViewImage((ImageView) v, text); } } else { throw new IllegalStateException(v.getClass().getName() + " is not a " + " view that can be bounds by this SimpleAdapter"); } } } } } private void setViewImage(ImageView v, Bitmap bmp){ v.setImageBitmap(bmp); } } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.