为什么我在一个类中声明一个方法来存储手机的IMSI的值,如下:
public void saveSimno(Context context)
{
TelephonyManager telephonyManager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
preferences = getSharedPreferences("IMSI", Context.MODE_PRIVATE);
editor = preferences.edit();
editor.putString("IMSI", telephonyManager.getSubscriberId());
editor.commit();
}
到本程序的其他.java的文件中,想读出该IMSI值时,会在 preferences = getSharedPreferences("IMSI", Context.MODE_PRIVATE);这句话报空指针异常?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
欢迎选择我的课程,让我们一起见证您的进步~~