Rakesh
Rakesh

Reputation: 15057

Doubts with base adapter class and its functionality

I am trying for the customized list view,

I am adding the list of objects using array list and i send it to the class that extends base adapter and when i extends the base adapter class,it implements some methods such as getView etc.

and in the getView i am sending it to the class which assign the names(datas) to customized menu which is in XML

what i want to know is that ,suppose i have a collection of 5 objects and does the getView get called for 5 Objects?

Am i making it clear to you.

Regards

Rakesh Shankar.P

Upvotes: 2

Views: 259

Answers (2)

Dinushan
Dinushan

Reputation: 2077

I placed a Log.d() in the getView() and noticed that getView() has been called 5 times.
i.e. getView() is called for 5objects and therefore 5 Views are created.

And this tutorial says if you have a billion items ,instead of billion Views are get created - views will be cached according to the size of the window.

Upvotes: 0

Rich Schuler
Rich Schuler

Reputation: 41972

Adapter#getView is only called when the AdapterView requires a view. You should not make any assumptions about how frequently or how many times getView is called. The only thing getView should do is return the required view as quickly as possible.

Upvotes: 1

Related Questions