import android.content.Context;
import android.provider.Settings.Secure;
string aa;
aa = "";
Context context = null;
aa = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);//这句话出的问题!!!
请帮忙看一下,这句话哪里有问题吗?
非常感谢!!!
  

解决方案 »

  1.   

    这个context 是不是不能为null,应为当前context
      

  2.   

    context是指一个activity,具体不知道你的思路是什么,你看下要怎么获取
      

  3.   

    Context  你可以用ApplicationContext获取
      

  4.   

    谢谢大家的回答!问题已经解决了!
    方法是在初始化时传进一个 :
     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..