I'm working on ListView
. I want to know when exactly getView()
is called. Is it called once the adapter is set? And does the line next to "setting adapter" get called once the getView()
method completes execution?
Please help me know which line gets executed once the getView()
finishes execution.
That would be a great help for me.
Thanks in advance, Vaishnvai
getView(int position, View convertView, ViewGroup parent) Get a View that displays the data at the specified position in the data set. abstract int. getViewTypeCount() Returns the number of types of Views that will be created by getView(int, View, ViewGroup) .
convertView is the ListView Item Cache that is not visible, and hence it can be reused. It lets the ListView need not create a lot of ListItems, hence saving memeory and making the ListView more smooth.
getView()
is called for each item in the list you pass to your adapter.
It is called when you set adapter. When getView()
is finished the next line after setAdapter(myAdapter)
is called.
In order to debug getView()
you must toggle a breakpoint on it because you can't step into getView()
from setAdapter(myAdapter)
.
getView()
is also called after notifyDataSetChanged()
and on scrolling.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With