0

Someone please explain why when I save the application settings (SharedPreferences) after dialog (AlertDialog),and update the data in the ListAdapter's item the following way mListItems.get(viewPosition).setValue(prefsIntValue); (mListItems - is the member of main activity). after closing dialog window the view in the ListView is updated, and when I try to do the same thing in the method onActivityResult ( update the data on the completion of the other activity) , nothing happens, in other words, view is not updated. kind of an answer is here notifyDataSetChanged example, but then why does the first case ( after the dialog box ) work!?

UPD: Calling notifyDataSetChanged after I changed list data in onActivityResult method helped! But please, someone, explain why in the first case, when saving preferences, it worked?!

Community
  • 1
  • 1

1 Answers1

0

Found the answer, because method onWindowFocusChanged http://androidxref.com/4.2_r1/xref/frameworks/base/core/java/android/widget/AbsListView.java#2646 called after I close AlertDialog window, the layout list view is being redrawn by calling layoutChildren in the method above in which happens all the magic.