0

I am extending ArrayAdapter<UrlItem> class and have overridden the following method:

@Override
    public View getView(int position, View convertView, ViewGroup parent) {
}

I observed that, this method gets called several times. I want to ask, how do you know how many times this gethod gets called to return the View? I want to know how getView() works?

MrLore
  • 3,759
  • 2
  • 28
  • 36
Max Usanin
  • 2,479
  • 6
  • 40
  • 70

2 Answers2

1

There is absolutely no guarantee on the order in which getView() will be called nor how many times.

Look at this SO Question custom listview adapter getView method being called multiple times, and in no coherent order and a nice tutorial http://android.amberfog.com/?p=296 .

Community
  • 1
  • 1
user370305
  • 108,599
  • 23
  • 164
  • 151
1

No. of getview calling method is depend on no. of objects or size of arraylist you passed in adapter. suppose you want to display 5 items in listview of gridview then this method is called 5 times.

Android Dev
  • 198
  • 1
  • 3
  • 11
  • No, Its not true.. Try with your code, Set adapter to `Listview` and debug your `getView()`code. Also fix the arraylist size. Also try this on different size devices.. – user370305 Aug 13 '12 at 11:34