Posts

Android | Kotlin | NULL SAFETY

Kotlin | NULL SAFETY Elvis Operator:  ?: x ?: y ---- evaluates x,  If x!=null, Then the result of the expression = x   Else           Result of expression = y    // (which ought to be of a non-nullable type) We can also use this operator to perform an early return in case of null: Example : val z = x ?: return y  Explanation:      If x!=null        Assign x to z    Else        the entire function that contains this expression will stop and return y.       (this works because return is also an expression, and if it is evaluated, it evaluates its argument and then makes the containing function return the result...

Android | Get File Path From URI | Real File Path Solution for Nougat (7.0, 7.1), Oreo, Pie | Real File Path Issue for Pie with file provider for Download location

Android | Android Context | Different Types Of Context | Application Context | Activity Context | getContext()

Android | Context  What is context in android? Context  is an interface to global information about an application environment. This is an  abstract  class whose implementation is provided by the Android system.  Context  is the context of the current state of the application/object.  It lets newly-created objects understand what has been going on.  It allows access to application resources, classes   as well as up-calls for application-level operations such as launching activities, broadcasting and receiving intents, etc. It allows our application components to interact with the outside  android environment like  local files, databases, class loaders associated to the environment, services including system-level services, and more. There are many different types of context in android. Wrong use of context can easily lead to memory leak in an android application. So, let's give a look to ...