I'm trying to make a ListView
with TextView
and ImageView
(obtained through a URL), when I was only with TextView
was appearing normal, but when I added the code to the images, the screen all white. What could be the problem?
I used the setImageURI()
method to set the image link.
the code I'm using is as follows:
public View getView(int position, View convertView, ViewGroup parent) {
View rowView = convertView;
StockQuoteView sqView = null;
if(rowView == null)
{
// Get a new instance of the row layout view
LayoutInflater inflater = activity.getLayoutInflater();
rowView = inflater.inflate(R.layout.noticia_list_item, null);
// Hold the view objects in an object,
// so they don't need to be re-fetched
sqView = new StockQuoteView();
//sqView.quote = (TextView) rowView.findViewById(R.id.ticker_symbol);
sqView.ticker = (TextView) rowView.findViewById(R.id.ticker_price);
sqView.img = (ImageView) rowView.findViewById(R.id.img);
// Cache the view objects in the tag,
// so they can be re-accessed later
rowView.setTag(sqView);
} else {
sqView = (StockQuoteView) rowView.getTag();
}
// Transfer the stock data from the data object
// to the view objects
Noticias currentStock = (Noticias) stocks.get(position);
sqView.ticker.setText(currentStock.getTitulo());
sqView.img.setImageURI(currentStock.getImagem());// bom aqui eu pensei que o setImageURI iria setar o link da imagem e assim exibi-la... mas é necessário uma conversão pra bitmap?
// sqView.quote.setText(currentStock.getDescricao());
return rowView;