急!开发的安卓程序在三星的Galaxy Tab3 P5210上打开提示已停止!在爱国者平板上可以使用! import android.content.Context;import android.provider.Settings.Secure;string aa;aa = "";Context context = null;aa = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);//这句话出的问题!!!请帮忙看一下,这句话哪里有问题吗?非常感谢!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个context 是不是不能为null,应为当前context context是指一个activity,具体不知道你的思路是什么,你看下要怎么获取 Context 你可以用ApplicationContext获取 谢谢大家的回答!问题已经解决了!方法是在初始化时传进一个 : private Context ctx; public PhoneInfo(Context context){ ctx=context; telephonemanager=(TelephonyManager)context .getSystemService(Context.TELEPHONY_SERVICE); }在调用时: String aa="";aa = Secure.getString(ctx.getContentResolver(), Secure.ANDROID_ID);顺利获取aa.. android ViewFlipper滑屏问题 如何修改android系统时间 请教高手:怎么让button和button外层都响应点击事件 关于android解锁问题 求救 一个小问题,有关SQLite数据库,进来看看 Android Eclipse中现有项目Ctrl+鼠标左键没办法使用,还有Graphical Layout没办法显示。 怎么在eclipse中导入安卓源码 求android系统自带联系人源码一份 bash:build/soong/soong_ui.bash:权限不够 android百度地图空白问题 【个人作品】高强度加密笔记本
方法是在初始化时传进一个 :
private Context ctx;
public PhoneInfo(Context context){
ctx=context;
telephonemanager=(TelephonyManager)context
.getSystemService(Context.TELEPHONY_SERVICE);
}
在调用时:
String aa="";
aa = Secure.getString(ctx.getContentResolver(), Secure.ANDROID_ID);
顺利获取aa..