private void endCall() {
Class<TelephonyManager> c = TelephonyManager.class;
Method getITelephonyMethod = null;
try {
getITelephonyMethod = c.getDeclaredMethod("getITelephony",(Class[]) null);
getITelephonyMethod.setAccessible(true);
ITelephony iTelephony = (ITelephony) getITelephonyMethod.invoke(mTelephonyManager, (Object[]) null);
iTelephony.endCall();
//iTelephony.dial("10086");
Log.v(this.getClass().getName(), "endCall......");
} catch (Exception e) {
Log.e(this.getClass().getName(), "endCallError", e);
}
}
这个方法,看不太懂,谁能帮我讲解一下?
谢谢
Class<TelephonyManager> c = TelephonyManager.class;
Method getITelephonyMethod = null;
try {
getITelephonyMethod = c.getDeclaredMethod("getITelephony",(Class[]) null);
getITelephonyMethod.setAccessible(true);
ITelephony iTelephony = (ITelephony) getITelephonyMethod.invoke(mTelephonyManager, (Object[]) null);
iTelephony.endCall();
//iTelephony.dial("10086");
Log.v(this.getClass().getName(), "endCall......");
} catch (Exception e) {
Log.e(this.getClass().getName(), "endCallError", e);
}
}
这个方法,看不太懂,谁能帮我讲解一下?
谢谢
解决方案 »
- java语言里边的$起什么作用啊?
- 如何获得程序的安装路径
- android webservice调用wsdl
- 关于EditText的onTextChange函数
- adapter的getView()方法里的listview的点击事件屏蔽了Activity中的listview的点击事件,求解决方案~
- 小弟做的一个android应用,欢迎大家前来排版
- 这个listview哪错了。
- RadioButton默认按钮取消不掉的问题
- 阿里云搭建APP服务器
- 关于Android学习,求大神指点12
- public void中使用getWritableDatabase()出错
- ubuntu运行emulator问题。
首先获得在Application Framework中获取一个TelephonyManager的实例 c
然后之后的代码和android没什么关系了,就是java反射嘛 c.getDeclaredMethod 获取这个类声明了哪些方法,
详见JDK API 这个包: java.lang.reflect
Method getITelephonyMethod = null;
try {getITelephonyMethod = c.getDeclaredMethod("getITelephony",(Class[]) null);getITelephonyMethod.setAccessible(true);这四句不懂,不了解反射?