Simple Android Architecture : LiveData and event

김정현
Mar 13, 2020

--

Table of Contents

This is one of series of Simple Android Architecture. and you can check sample code there.

This article is about Livedata and Event

When you use MVVM, you would find that there are two cases of data

  1. Just data which is shown on layout
  2. The event which should be called one time even if Activity/Fragment is recreated. like toast, dialog, starting activity.

Someone says that viewLifecycleOwner solved the issue, but In my understanding it just solved the memory leak.

And the two cases are difficult to be merged to one case, as the purpose are different.

solution is migrated to https://dss99911.github.io/android/2023/12/24/livedata-event.html

--

--