Last active
January 3, 2019 02:08
-
-
Save anderscheow/38f833765f6e2e7d0833fe0d461a5cb0 to your computer and use it in GitHub Desktop.
A custom Application which include Multidex and Flutter initialization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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