Dynamic gallery does not work for me when it is set up in android
I'm a newbie to Android. I have a gallery in which images are displayed from URL. I cannot see the images when the gallery is set up for the first time, When I scroll the gallery, then all the images are set. I logged in getView()
of Adapter (derive开发者_如何学编程d from BaseAdapter), and saw that getView
works only after I clicked the item.
How to resolve this..
@Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
ImageView iv = new ImageView(context);<br>
//method that displays image from url
imageLoader.displayImage(myimageurls[arg0], activity, iv);
Log.i("Gallery", "Image URL = " + myimageurls[arg0]);<br>
}
Try calling notifyDataSetChanged() from your adapter right after the initialization of your gallery. This forces a redraw on that particular AdapterView (Gallery in this case)
JQCorreia
精彩评论