Android Developer의 내용부터 확인해보면
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.
Application환경의 전반적인 정보에 대한 인터페이스로 Resources나 Class 등을 이용할 떄 필요함.
그리고 이는 Activity, Service등의 컴포넌트들이 Implement한다.
Application과 연관이 있는 System Level의 함수를 사용할 때도 사용.
구글링을 통해서 찾아보면 모두가 비슷한 말을 하고있다.
현재의 상태를 알고있는 객체이며, Context의 종류도 다양하기 때문에 적재적소에 사용을 하여야 오류나 메모리 누수가 안난다.
Context를 사용하는 맥락도 대부분 비슷한 구석이 있었다.
생각해보면 Toast를 사용하거나, DB를 만들거나,
Color를 사용하거나,
Dialog크기를 변경하는 등 등등 Context가 필요하였고,
이는위에서 설명한것처럼 Class외부 Application의 정보나 System이 필요할 경우 사용했던거 같다.
아래의 블로그를 참고하면 더 이해가 잘갈것임
https://jslee-tech.tistory.com/19
안드로이드 Context
Android 개발을 하다 보면 Context라는 용어를 정말 자주 접하게 된다. 예를 들어, 화면 전환을 위해 Intent를 사용하려 하면 첫 번째 Parameter로 packageContext를 받고 Toast 메시지를 사용하려 해도 첫 번째.
jslee-tech.tistory.com
https://arabiannight.tistory.com/284
안드로이드/Android Context 란?
안드로이드/Android Context 란? <안드로이드 Context 는 수수께기가 많은 클래스입니다> Android Context Story 저에게 안드로이드 Context 는 참 어려운 녀석입니다. 안드로이드 어플리케이션을 개발하며서.
arabiannight.tistory.com
'안드로이드 읽어보기' 카테고리의 다른 글
android injection 종속성 삽입 (0) | 2021.12.23 |
---|---|
android compose 공부하기 전 뭔가만 알아보기 (0) | 2021.05.29 |
동기 비동기의 설명 링크 (0) | 2021.05.14 |