Android widget: Activity context vs. Application context
2013-12-13 09:53 xiao蜗牛 阅读(380) 评论(0) 编辑 收藏 举报1 Something we know:
Activity & Application are all indirect subclasses of Context.
java.lang.Object
↳ android.content.Context
↳ android.content.ContextWrapper
↳ android.view.ContextThemeWrapper
↳ android.app.Activity
--------------
java.lang.Object
↳ android.content.Context
↳ android.content.ContextWrapper
↳ android.app.Application
2 From the above hierarchy view we find out that the difference between Activity and Application
is the class 'ContextThemeWrapper' -- it's the parent of Activity, but not Application.
3 What does ContextThemeWrapper for?
A ContextWrapper that allows you to modify the theme from what is in the wrapped context.
So, we get the biggest difference between Activity and Application:
We can modify the theme by Acitity, but can't by Application .
4 How does Activity modify the theme?
To be continued...