Android의 Context는 뭐하는 녀석일까...? (작성중)
String, Int, Activity, Flow .... 얘들은 어떤 놈인지 직관적으로 상상이 된다.
근데 Context <- 얘는 감이 안잡힘.
코드 짤때 쓰고 있으면서도, 이게 왜,어느 부분에 필요한지 이해가 안된상태.
예를들어 println() 함수가 String 값을 요구하는 것은 직관적으로 납득이 된다. 내용이 비어있든 뭐든 간에 일단 출력할 게 필요하니까.
근데 context는?
일단 안드 공식문서에 적혀있는 내용부터 확인하자.
Interface to global information about an application environment. This is an abstract class whose implementation is provided by the Android system. It allows access to application-specific resources and classes, as well as up-calls for application-level operations such as launching activities, broadcasting and receiving intents, etc.
(앱을 사람에 비유했을때)
개인정보 (어디서 왔고, 뭐하는 놈이며,이런저런 상황에는 이녀석에게 어떻게 대응해야 할지)에 가까워 보인다. 작성하다 보니까 이해해버렸다.
댓글
댓글 쓰기