Android 电话管理器实例化
我似乎无法在android中声明TelephonyManager,这就是我要做的:Android 电话管理器实例化,android,android-context,telephonymanager,Android,Android Context,Telephonymanager,我似乎无法在android中声明TelephonyManager,这就是我要做的: TelephonyManager tele = Context.getSystemService(Context.TELEPHONY_SERVICE); 我这样做对吗?你忘了投。应该是这样的: TelephonyManager tele = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); 另外,如果我们不在活动中,我们需要这样调用
TelephonyManager tele = Context.getSystemService(Context.TELEPHONY_SERVICE);
我这样做对吗?你忘了投。应该是这样的:
TelephonyManager tele = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
另外,如果我们不在活动中,我们需要这样调用它:
TelephonyManager TelephonyManager=(TelephonyManager)context.getSystemService(context.TELEPHONY_SERVICE)代码>