我是机器人的新手。
我正在为SIM卡ToolKit编写工具测试程序
我需要使用仅在PhoneBase界面中可用的CommandsInterface。一旦我有了电话,我想使用下面的线路:
private Phone mPhone;
private Context mContext;
private Handler mHandler;
private CommandsInterface mCmdIf;
private PhoneBase mPhoneBase;
mPhoneBase = ((PhoneBase)mPhone); <==== uncaught exception
mCmdIf = mPhoneBase.mCM;它编译成功,但是给出了未捕获的异常(group=0x4001b188)请建议如何克服这个问题。预先感谢Micha
发布于 2010-04-08 21:53:38
你不能直接使用PhoneBase,因为它是安卓内部的,在SDK中不可见。您可以使用logcat检查您的异常消息。
从源代码中:
/**
* (<em>Not for SDK use</em>)
* A base implementation for the com.android.internal.telephony.Phone interface.
*
* Note that implementations of Phone.java are expected to be used
* from a single application thread. This should be the same thread that
* originally called PhoneFactory to obtain the interface.
*
* {@hide}
*
*/我不知道mCM是什么,但我猜你可以从TelephonyManager上获得这些信息。你可以做到的
Context.getSystemService(Context.TELEPHONY_SERVICE);https://stackoverflow.com/questions/2600247
复制相似问题