Tenho imagens no drawable e tenho o nome de todas elas na tabela do SQLite. Como faço para exibir essas imagens no meu listView Personalizado?
Observação: As imagens que estão na pasta drawable, eu adicionei manualmente,(CTRL + C) (CTRL + V)
public View getView(int position, View convertView, ViewGroup parent) {
Bitmap raw;
byte[] fotoArray;
View v = View.inflate(context,R.layout.activity_produto_item,null);
TextView nome = (TextView)v.findViewById(R.id.tvNome);
ImageView imagem = (ImageView)v.findViewById(R.id.tvImagem);
nome.setText(lista_exibicao.get(position).getNome());
fotoArray = lista_exibicao.get(position).getImagem();
if(fotoArray!=null){
raw = BitmapFactory.decodeByteArray(fotoArray,0,fotoArray.length);
imagem.setImageBitmap(raw);
}
v.setTag(lista_exibicao.get(position).getId());
return v;
}Discussão (0)
Carregando comentários...