Note that there are some explanatory texts on larger screens.

plurals
  1. POSometimes my icons in my list view are not showing
    primarykey
    data
    text
    <p>My problem is that I have implemented a custom arrayadapter, that fetches images from an url and sets them to an imageview. It works, sort of. Sometimes some of the images are not showing up. Somtimes it's only one image, somtimes it's three and in no apparent order. Only thing that's reasonably consistent is that it seems to be image number 3 in my arraylist.</p> <p>My custom adapter:</p> <pre><code>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; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload