Моя проблема заключается в том, что я реализовал собственный адаптер массива, который извлекает изображения из URL и устанавливает их для просмотра изображений. Это работает, вроде. Иногда некоторые изображения не отображаются. Иногда это только одно изображение, иногда три, и не в очевидном порядке. Единственное, что разумно согласуется, так это то, что это выглядит как изображение № 3 в моем архиве.
Мой пользовательский адаптер:
public CustomAdapter( Context context, int textViewResourceId, List items )
{
super( context, textViewResourceId, items );
this.items = items;
}
@Override
public View getView( int position, View convertView, ViewGroup parent )
{
View v = convertView;
if ( v == null )
{
LayoutInflater vi = ( LayoutInflater ) getContext().getSystemService( Context.LAYOUT_INFLATER_SERVICE );
v = vi.inflate( R.layout.list_item, parent, false );
}
Object o = items.get( position );
if ( o != null )
{
TextView textView = ( TextView ) v.findViewById( R.id.listItem );
ImageView imageView = ( ImageView ) v.findViewById( R.id.icon );
if ( textView != null )
{
textView.setText( o.toString() );
}
if ( imageView != null )
{
if ( o instanceof XmlGuide )
{
try
{
imageView.setImageBitmap( downloadIcon( ( ( XmlGuide ) o ).getIcon() ) );
}
catch( Exception e )
{
e.printStackTrace();
}
}
}
}
return v;
}
private Bitmap downloadIcon( String uri ) throws Exception
{
URL url = new URL( uri );
InputStream stream = url.openStream();
Bitmap icon = BitmapFactory.decodeStream( stream );
stream.close();
return icon;
}