Skip to content

Instantly share code, notes, and snippets.

@anderscheow
Last active January 3, 2019 02:08

Revisions

  1. anderscheow revised this gist Jan 3, 2019. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions CustomApplication.kt
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,11 @@
    package com.example

    import android.app.Activity;
    import android.app.Application;
    import android.app.Activity
    import android.app.Application
    import android.content.Context
    import android.support.multidex.MultiDex

    import io.flutter.view.FlutterMain;
    import io.flutter.view.FlutterMain

    class CustomApplication : Application() {
    override fun attachBaseContext(base: Context) {
    @@ -19,6 +19,7 @@ class CustomApplication : Application() {
    }

    private var mCurrentActivity: Activity? = null

    fun getCurrentActivity(): Activity? {
    return mCurrentActivity
    }
  2. anderscheow created this gist Oct 23, 2018.
    29 changes: 29 additions & 0 deletions CustomApplication.kt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    package com.example

    import android.app.Activity;
    import android.app.Application;
    import android.content.Context
    import android.support.multidex.MultiDex

    import io.flutter.view.FlutterMain;

    class CustomApplication : Application() {
    override fun attachBaseContext(base: Context) {
    super.attachBaseContext(base)
    MultiDex.install(this)
    }

    override fun onCreate() {
    super.onCreate()
    FlutterMain.startInitialization(this)
    }

    private var mCurrentActivity: Activity? = null
    fun getCurrentActivity(): Activity? {
    return mCurrentActivity
    }

    fun setCurrentActivity(mCurrentActivity: Activity) {
    this.mCurrentActivity = mCurrentActivity
    }
    }