Contextコンテキストの理解とコンテキストを得るいくつかの方法
1348 ワード
Context理解
Context関連クラスの継承関係
アプリケーション、Activity、サービスをContextとする違い
1.同じ点:
2.相違点
1つのアプリケーションにどれだけのcontextがあるか
取得したcontextのいくつかの方法
Context , Context ,
, 、 ,Context
, ,Activity Service
, ,
ContextImpl ,Activity Service
Context関連クラスの継承関係
Context ---> ContextImx
---> ContextWrpper ---> ContextThemeWrpper ---> Acitivity
---> Service
---> Application
:Activity 、Service 、Application Context ,
context
アプリケーション、Activity、サービスをContextとする違い
1.同じ点:
Context
2.相違点
, ,Service Application ,
Activity ContextThemeWrapper, Activity , Service
`
,Application , Activity 。Context ContextImpl ,
Context ContextImpl , ActivityThread ,Activity
ActivityThread , ,Application Service ActivityThread 。
1つのアプリケーションにどれだけのcontextがあるか
: Context = Service + Activity + 1(Application Context )
取得したcontextのいくつかの方法
1.this
2.HomeActivity.this
3.getApplication().this
4.getContext()