<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.bokchi.viewmodelcontext">
<application
android:name=".App"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.ViewModelContext"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
class App : Application() {
init {
instance = this
}
companion object {
private var instance: App? = null
fun context() : Context {
return instance!!.applicationContext
}
}
}
- 참조
https://dreamaz.tistory.com/53
https://ddangeun.tistory.com/78
'Android(Kotlin)' 카테고리의 다른 글
Andorid AlarmManager (0) | 2022.10.29 |
---|---|
Android Shimmer (0) | 2022.10.22 |
Android BOOT_COMPLETED (0) | 2022.10.20 |
Simple ForegroundService (0) | 2022.10.15 |
Android ROOM sqlcipher (0) | 2022.09.20 |