我必须使用android ITelephony android电话上的内部类。我使用ITelephony通过获取其实例作为如何在android中获取Phone实例?
ITelephony phone = ITelephony.Stub.asInterface(
ServiceManager.getService(Context.TELEPHONY_SERVICE)
);
拨打电话,然后用
phone.call(destNum);
现在我需要执行像抱着一个呼叫其他行动呼吁。 ITelephony没有为此提供API,但是我找到了一个具有switchHoldingAndActive()
的Phone类,但为了调用此类,我需要一个Phone实例到当前正在运行的活动呼叫。我试图
Phone PhoneActive = PhoneFactory.getDefaultPhone();
但它给了我一个异常说
Caused by: java.lang.RuntimeException:
Can't create handler inside thread that has not called Looper.prepare()
什么是得到一个电话实例的正确方法?
喜是我的是不是一个UI线程它的服务,但我使用ASYN任务请看我的代码,让我知道我应该更改 – user954299
in onExExcute方法的ASYNC任务,我打电话Phone.getDefaultPhone() – user954299