Skip to content

Instantly share code, notes, and snippets.

@anderscheow
Last active January 3, 2019 02:08
Show Gist options
  • Save anderscheow/38f833765f6e2e7d0833fe0d461a5cb0 to your computer and use it in GitHub Desktop.
Save anderscheow/38f833765f6e2e7d0833fe0d461a5cb0 to your computer and use it in GitHub Desktop.
A custom Application which include Multidex and Flutter initialization
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
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment