public abstract class Contextpublic class ContextWrapper extends Context public class ContextThemeWrapper extends ContextWrapper {public class Activity extends ContextThemeWrapper
第二个类  ContextWrapper 实现了Context 中的所有抽象函数
并且是如下的代码(以函数getPackageManager为例):
   public PackageManager getPackageManager() {
        return mBase.getPackageManager();
    }其中 mBase是ContextWrapper  中的 一个 私有变量
Context mBase;
我就不清楚了  这个到底是如何实现 函数 getPackageManager有没有达人可以帮我解惑下谢谢了

解决方案 »

  1.   

    getPackageManager没有被具体实现,因为mBase是Context类的对象;
    文档说:
    abstract PackageManager  getPackageManager()
    Return PackageManager instance to find global package information.
    因此,并没有被实现!所以,“它还是个剃须刀!”
      

  2.   

    刚才我继续看源码,我觉得应该是在framework/base/core/java/com/android/app/ContextImpl(AppliactionContext)来实现mBase的,ContextImpl也是继承Context的。
      

  3.   

    /**
     * Common implementation of Context API, which provides the base
     * context object for Activity and other application components.
     */
    class ContextImpl extends Context