Saturday 21 September 2019

Android LiveData

Hello guys. here i m sharing information about Live Data. updates in Android.

- Lets see how it will help full for Developing Application.

- LiveData usefull for observable Data Class which holds all the Data.

- You can create singleton object of  LiveData and can share that common Data between Activity, Fragments , Services.

Life-cycle of Data with

Start and Resume.

- LiveData notifies when any Update happen in Data under Observe method.

- So now to bind view controls with LiveData objects , no need to worried about do any other update operation to get updated value bind with Ui.

- All Views related to bind with LiveData objects  will automatically get up to date with updated values.

Advantage Of LiveData in Application.

- All Time up to Date Data with all view-Controls.

- Automatically clean up there Data, so no Memory-Leak issue more.

- when Activity press back then LiveData goes inActive state. So Its avoid to crash Application.

- Its can use with ViewModel, Room etc where you require to use it in proper way.


No comments:

Post a Comment

Comments

Find Hours Diffrence in Kotlin

  In Kotlin, determining the difference in hours between two timestamps is a common task, especially in scenarios involving time-based calcu...