Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

For a ListView adapter, how is getView() called?

I've looked around quite a bit but haven't found a real answer to this question. I'm just starting to learn about android adapters and had a few questions. Firstly, do I need to call getView() manually or does it get called automatically? If so, when is it actually called? Lastly, I noticed there's a parameter for "position" with in the list. Is that something I have to increment through iteration or does it get incremented internally somehow?

thanks!

like image 249
Will Avatar asked Oct 20 '22 22:10

Will


1 Answers

Firstly, do I need to call getView() manually or does it get called automatically?

No, it get called automatically.

If so, when is it actually called?

It will be called when user do something to your ListView, like when the ListView displaying a new item when you scrolling it.

Lastly, I noticed there's a parameter for "position" with in the list. Is that something I have to increment through iteration or does it get incremented internally somehow?

No, it will be your list item's position automatically. Its the same for other params like (the default) View convertView, it will be the View of current item (row of ListView).

like image 124
Blaze Tama Avatar answered Oct 27 '22 09:10

Blaze Tama