looking for some solutions? You are welcome.

SOLVED: How to access a member of a class "statically" in kotlin?


In Java and Android, we can do this:

public static MyApplication extends Application {
   private static Context appContext;

   public static Context getAppContext() {
      return appContext;

so that, somewhere else, we can do this:

appContext = MyApplication.getAppContext();

How do we do this in Kotlin? I've been going round in circles for the past hour or so.

Thanks in advance.

Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered

No comments: