Commit 160c1250 authored by Aayush Gupta's avatar Aayush Gupta
Browse files

MainActivity: Provide a way to access the applicationContext via MainActivity


Signed-off-by: Aayush Gupta's avatarAayush Gupta <theimpulson@e.email>
parent 70e22125
......@@ -70,11 +70,24 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
private var isReceiverRegistered = false
var accentColorOS = 0
init {
instance = this
}
companion object {
private var instance: MainActivity? = null
lateinit var mActivity: MainActivity
var sharedPreferences : SharedPreferences?=null
val sharedPrefFile = "kotlinsharedpreference"
/*
* Provides the application context via MainActivity
* @return applicationContext
*/
fun applicationContext(): Context {
return instance!!.applicationContext
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment