2010년 7월 6일 화요일

Context

Context는 OS입장에서 실행 중인 application을 관리하기 위한 자료구조라고 보시면 될 것 같습니다.
Class를 생성할 때 또는 정보를 얻고자 할때 context가 parameter로 많이 사용이 되는데
이는 Class memory를 할당하거나 정보를 얻고자 하는 memory block 정보를 검색하기 위해서
어떠한 application에서 요청했는지가 필요하기 때문입니다.

예를들어서 TextView를 생성하는 경우 내부적으로는 heap memory를 할당하고
해당 memory pointer를 Application context 정보를 기반으로 관리하는 것이고
Application이 종료하게 되면 해당 application이 사용하는 heap memory를 free하는데 사용합니다.


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.