全局获取Context
创建MyApplication类,用MyApplication.context获取
import android.annotation.SuppressLint
import android.app.Application
import android.content.Context
class MyApplication : Application() {
companion object {
@SuppressLint("StaticFieldLeak")
lateinit var context: Context
}
override fun onCreate() {
super.onCreate()
context = applicationContext
}
}
git管理
git add .
git commit -m "xxx commit."
git push