Difference between LiveData, StateFlow, SharedFlow, Flow.
LiveData
LiveData is an lifecycle aware obervable data holder ( means it knows the lifecycle of the activity or an fragment) use it when you play with UI elements(views).
StateFlow
StateFlow(hot stream) does similar things like LiveData but it is made using flow by kotlin guys and only difference compare to LiveData is its not lifecycle aware...
Hilt Dependency injection
Hilt is the next generation dependency injection framework from Google. It’s built on top of Dagger and simplifies DI greatly.Hilt provides a standard way
for your application to do DI by providing a container for every Android class in your project and automatically managing its lifecycle. Hilt is built on top
of the well-known DI library Dagg...
Animated-Vector-Drawable-Path-Morphing
Animated-Vector-Drawable-Path-Morphing
Here’s my attempt at gathering all the required information and compressing it to something you can easily understand what is all about Animated vector drawable and how this is helping to animate some of complex animation. The reason I selected this topic is that, Google ...
Spannable Text
Spannable Text
Spans are helpful to style text, it help us to change the color of specific portion of the text, help us to make specific portion to be clickable, resizable , there many other use cases where we make use of the spannable text. Frequently, you come across one common style where you want to change the color of some portion and make ...
Adding environment variables In Unix, Linux
@Adding environment variables In Unix, Linux Environment
In Linux Or Unix environment , All your environment variables are stored in the .bash_profile file which is stored in the root directory. Every time you want to add new environment variable, you will make changes to this file.
Say, you want to add an environment variable for username, you...
ViewModelScope
Why do we need View Model Scope ?
Lets take example of it,
class MainFragment : Fragment() {
fun loadData() = GlobalScope.launch { viewModel.startExecution() }
}
class YourViewModel : ViewModel() {
suspend fun startExecution() {
withContext(Dispatchers.IO) {
for (i in 0..10000000) {
...
Communicate with other fragments
Communicate with other fragments?
All Fragment-to-Fragment communication is done either through a shared ViewModel or through the associated Activity. Two Fragments should never communicate directly, The recommended way to communicate between fragments is to create a shared ViewModel object. Both fragments can access the ViewModel through their ...
Kotlin Scoping function
Kotlin let, run, also, apply, with
Kotlin’s standard library includes some often-used scope functions that are so abstract that even those who have been
programming in Kotlin for a while can have a hard time keeping them straight. In this guide, I am going to clarify four
of these scope functions in particular
Let’s understand each one of th...
Android Room
What is Room ?
The Room persistence library provides an abstraction layer over SQLite. library takes care most of complicated stuff that we previously had to do ourselves, we will write much less boilerplate code to create tables and make database operations.
Sqlite in android is not that cool
You need to write out a boilerplate code to conv...
Android Coroutine
Summary
Let me start off with basic elements of thread, concurrency before I start with coroutine.
We all know that Synchronous basically means that you can only execute one thing at a time. where as Asynchronous means that you can execute multiple things at a time and you don’t have to finish executing the current thing in order to move on to...
16 post articles, 2 pages.