在Android写Activity时我们总是需要重写onCreate(Bundle)方法
在源码中可以看到:
protected void onCreate(Bundle savedInstanceState) {
        mVisibleFromClient = !mWindow.getWindowStyle().getBoolean(
                com.android.internal.R.styleable.Window_windowNoDisplay, false);
        mCalled = true;
    }
在构造方法中也没有见到注入Context对象的代码
请指教
Android系统中的Context是怎么注入进Activity的。

解决方案 »

  1.   

    Context是个抽象类,是Activity的基类,Activity本身就是个Context对象
      

  2.   

    Activity extends ContextThemeWrapperpublic class ContextThemeWrapper extends ContextWrapperpublic class ContextWrapper extends ContextContextWrapper 构造函数
    Public Constructors 
     ContextWrapper(Context base)  
      

  3.   

    额。描述有点问题。
    是这样子的
    我想要调用getPackageManager()方法
    在Activity中继承了ContextThemeWrapper
    而在Activity初始化没有特殊处理
    public Activity() {
            ++sInstanceCount;
        }
    那就是调用ContextThemeWrapper的
    public ContextThemeWrapper() {
            super(null);
        }
    构造函数
    那么在其父类ContextWrapper
    Context mBase;
    public ContextWrapper(Context base) {
            mBase = base;
        }
    此时他不是就是空的Context 
    那么后面的方法也没有办法有效了。而且目前我只在Context接口中看到了getPackageManager()方法
    其他都没发现。哪位指点下它是在哪里实现这个方法的。