通过反射调用 com.android.internal.telephony.IccFileHandler 下的 loadEFLinearFixed(...)函数。
类IccFileHandler的构造函数如下:protected IccFileHandler(PhoneBase phone) {
        super();
        this.phone = phone;
    }
但在调用loadEFLinearFixed的时候(method.invoke(...)),需要IccFileHandler的实例。这个实例该如何获取呢?
android反射构造

解决方案 »

  1.   

    Class c = Class.forName(className);
    Constructor constructor = c.getConstructor(Interge.Class, Interge.Class, Message.Class);
    IccFileHandler iccFileHandle = constructor.newInstance(param, param, param);
      

  2.   


    首先感谢你的解答。类IccFileHandler的构造是: protected IccFileHandler(PhoneBase phone)Constructor constructor = c.getConstructor(此处应该是PhoneBase类);
    Object instanceOfIccFileHandle = constructor.newInstance(此处应该是PhoneBase类的实例);
    其中PhoneBase的构造:protected PhoneBase(PhoneNotifier notifier, Context context, CommandsInterface ci);
    protected PhoneBase(PhoneNotifier notifier, Context context, CommandsInterface ci,
                boolean unitTestMode);如果我上述的方法正确,那么PhoneBase类的实例如何获得呢?