architecture-components-samples icon indicating copy to clipboard operation
architecture-components-samples copied to clipboard

How to observe one livedata on two pages?

Open taknikiniga opened this issue 3 years ago • 0 comments
trafficstars

i'm using navigation component in my android app. i have a search edit text on that i attach a text watcher. when that search edit text come into focus i open a seach fragment but under seach edit text. both pages are in live state .

this code is inside my home viewmodel

 val searchMData: MutableEventLiveData<String> = MutableEventLiveData()
val searchLiveData: LiveData<String>

from home activity i post value inside my ( searchMData ) throughout textwatcher and i want to observe ( searchLiveData ) Inside my Search Fragment.

please help......

taknikiniga avatar Jun 20 '22 11:06 taknikiniga