android一些有用的方法总结(持续更新……)这些方法在开发中用的上,在这里记录一下,以后查阅。转载请注明出处:
android一些有用的方法总结(持续更新……)
这些方法在开发中用的上,在这里记录一下,以后查阅。
转载请注明出处:http://heji.iteye.com/blog/757556,谢谢
通过反射获得ITelephony对象,并调用其endCall()方法private void invokeCallEnd() {ITelephony iTelephony = null; TelephonyManager telephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);try {Method getITelephonyMethod = TelephonyManager.class.getDeclaredMethod("getITelephony", (Class[]) null);getITelephonyMethod.setAccessible(true);iTelephony = (ITelephony) getITelephonyMethod.invoke(telephonyMgr, (Object[]) null); } catch (Exception e) { e.printStackTrace(); } try {iTelephony.endCall();} catch (RemoteException e) {// TODO Auto-generated catch blocke.printStackTrace();}}ITelephony.aidl是源码中的服务,需要放在所建的项目中,包名要和ITelephony.aidl文件中的包名一致,附件是ITelephony.aidl文件
