Replies: 3 comments
-
Application Class란?안드로이드 앱에서 전역적으로 사용될 상태나 데이터를 관리하기 위한 기본 클래스이다.
Application Class UseCase
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
initFirebase()
}
} <!-- AndroidManifest.xml -->
<application
android:name=".MyApplication"
... >
</application> Application Class 활용법
Application 내부 메서드
|
Beta Was this translation helpful? Give feedback.
-
📌 Application 클래스란?
공식 문서 정의:
즉, 하나의 애플리케이션에 대해 하나의 Application 인스턴스만 존재하며, 앱의 생명주기 전체에 걸쳐 유지됩니다. 🔧 주요 역할
✅ 사용 예시class MyApp : Application() {
override fun onCreate() {
super.onCreate()
// 앱 시작 시 1회 수행할 초기화 코드
Log.d("MyApp", "Application Created")
// 예: Firebase, Timber 초기화
// FirebaseApp.initializeApp(this)
// Timber.plant(DebugTree())
}
} 그리고 <application
android:name=".MyApp"
... >
</application> 🧠 Application 클래스 vs Activity
|
Beta Was this translation helpful? Give feedback.
-
Application class란?
Application class의 목적[사용자 정의 Application class]
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Q) 5. Application 클래스란 무엇인가요?
Beta Was this translation helpful? Give feedback.
All reactions