1

it's a simple question.

suppose i call notifyDatasetChanged(), and wish to be notified when the adapterView (listView/gridView/...) has finished calling getView() on the adapter, how do i do that?

The problem is that getView can be called multiple times on the same view, have weird order of calls and so you can never know when it has finished calling on all of the (currently shown) items.

would using this solution ( which uses the ViewTreeObserver and OnPreDrawListener) work on this case ?

Community
  • 1
  • 1
android developer
  • 114,585
  • 152
  • 739
  • 1,270
  • Or you could create a own interface – A.S. Oct 16 '13 at 08:29
  • Did you try that solution? – fasteque Oct 16 '13 at 08:30
  • @A.S. create an interface and then what? when should I call it? don't forget that getView can be called multiple times on the same view. – android developer Oct 16 '13 at 10:12
  • Oh sorry, did not quite understand your question, you want a call when your view is loaded the first time, every row? – A.S. Oct 16 '13 at 11:00
  • @A.S. i don't understand what you mean. when calling notifyDatasetChanged() , both listView and gridView call getView() multiple times till they stop and show the cells to the user. i want to be notified when they finish it. – android developer Oct 16 '13 at 11:28
  • But getView will also be called when you scroll in your grid/list – A.S. Oct 16 '13 at 11:58
  • @A.S. i know, but for that i can already be notified , using setOnScrollListener , so when the scrolling becomes idle again, i can ask to be notified about finishing with the getView operations again. – android developer Oct 16 '13 at 12:07
  • mmhhhh... sounds interresting, why exactly you want to get the notification that the list is loaded? – A.S. Oct 16 '13 at 12:24
  • @A.S. that's a long story for the current case (shortly it's because i need to use this buggy library : https://github.com/huewu/pinterestlikeadapterview/ ) . however, it's also pretty common request from people that ask me about it. – android developer Oct 16 '13 at 15:24

0 Answers0