Skip to content
This repository has been archived by the owner on Aug 25, 2020. It is now read-only.

getView() in BaseAdapter being called infinitely #7

Open
egfconnor opened this issue Sep 9, 2013 · 1 comment
Open

getView() in BaseAdapter being called infinitely #7

egfconnor opened this issue Sep 9, 2013 · 1 comment

Comments

@egfconnor
Copy link

I have some basic getView() code that is as follows:

public View getView(int position, View convertView, ViewGroup viewGroup) {
View v = inflater.inflate(R.layout.gallery_image_layout, null);
ImageView i = (ImageView) v.findViewById(R.id.houseImage);
i.setLayoutParams(new FrameLayout.LayoutParams(pictureWidth,
FrameLayout.LayoutParams.MATCH_PARENT));
FrameLayout layout = (FrameLayout) v
.findViewById(R.id.rootFrameLayout);
layout.setLayoutParams(new EcoGallery.LayoutParams(pictureWidth,
EcoGallery.LayoutParams.MATCH_PARENT));
House h = getItem(position);
AQuery aq = new AQuery(mContext);
aq.id(i).image(h.thumbnailURL, true, true, pictureWidth, 0);
return v;
}

When using AQuery it seems to never stop calling getView() and the gallery is blank with nothing there. Changing the two lines out to a simple ImageView.setImageResource() fixes it.

Any idea what's going on?

@Gryzor
Copy link

Gryzor commented Dec 19, 2013

I think you're supposed to recycle aquery… as in

in your getView() { final AQuery aq = mListAq.recycle(convertView); // use this local aq instance. }

and mListAq you initialize as a field in the constructor of your adapter (only once)

mListAq = new AQuery(yourContext);

(read AQuery documentation if you need more info)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants