@Override
public View getView(int position, View convertView, ViewGroup parent) {
final ImageView imageView;
TextView textView = null;
View childView = null;
int numTopics = mProductListDetail.getNumTopics();
if(convertView == null) { // if it's not recycled, initialize some attributes
int layoutId = R.layout.prod_list_item;
LayoutInflater li = ((Activity) mContext).getLayoutInflater();
childView = li.inflate (layoutId, null);
}
else {
childView = convertView;
}
if (childView != null) {
// Set the width and height of the child view.
//width=110 height=90
if(ProductListing.height < 400)
childView.setLayoutParams(new GridView.LayoutParams(110, 90));
else
childView.setLayoutParams(new GridView.LayoutParams(mCellWidth, mCellHeight));
int j = position + mImageOffset;
imageView = (ImageView) childView.findViewById (R.id.image);
try{
imageLoader.loadImage(mProductListDetail.getTopicImage(j), new ImageLoadedListener() {
public void imageLoaded(Bitmap imageBitmap)
{
imageView.setImageBitmap(imageBitmap);
imageView.invalidate();
}
});
}
catch (Exception e) {
Log.d("VM", "Exceptio in "+e.getMessage());
}
imageView.setBackgroundResource (R.drawable.border);
if (imageView != null) {
Resources res = mContext.getResources ();
int imagePadding = res.getDimensionPixelSize (R.dimen.grid_image_padding);
imageView.setPadding (imagePadding, imagePadding, imagePadding, imagePadding);
imageView.setTag (new Integer(j));
}
textView = (TextView) childView.findViewById (R.id.title);
if (textView != null) {
textView.setText(mProductListDetail.getTopicTitle (j));
textView.setTag (new Integer (j));
}
}
return childView;
}
I am using a grid view layout and have 8 images on a screen, when i scroll
down and up images change such as first image showing second last images
showing on second last...It means when you load image they are at correct
position where i want, but when i scroll down and up the images change
position..ho![images on screen]