본문 바로가기
Programing/android

[android studio] context 종류 및 역활

by TEXTBOX 2021. 11. 4.
728x90

View.getContext()
현재 실행되고 있는 View의 Context를 return
보통은 현재 활성화된 Activity의 Context가 됨

Activity.getApplicationContext()
Applcation Lifecycle에 해당하는 Context를 return

ContextWrapper.getBaseContext()
자신의 Context가 아닌 다른 Context에 접근할 때 사용

728x90

댓글