Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android gallery custom adapter

I have a question, maybe a silly one, but I think it is important.

Why the parameter: convertView (View) on the

public View getView(int position, View convertView, ViewGroup parent)

is always null? android is supposed to recycle the views once they're created the first time, isn't it? or how can I do to recycle those views?

I feel like the method receives those 3 parameters, but in none of the google examples they use either of them.

like image 937
lblasa Avatar asked Jan 20 '23 23:01

lblasa


1 Answers

Unfortunately, convertView will always be null, due to Android bug 3376. Gallery does not implement View recycling (at least as of Gingerbread/2.3.4).

A commenter in the bug suggests forking Gallery.java (from AOSP) and implementing it yourself, which may be the best option.

like image 120
mik3y Avatar answered Jan 22 '23 13:01

mik3y