【发布时间】:2023-03-31 00:52:01
【问题描述】:
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.layout_reg_dialog, null);
TextView tvIMEI = null;
builder.setView(view)
.setTitle("Activer la Version");
registerKey = view.findViewById(R.id.regiter_key);
tvIMEI = view.findViewById(R.id.tvIMEI);
String sIMEI;
sIMEI = getUniqueIMEIId(getContext(this));
tvIMEI.setText(sIMEI);
return builder.create();
}
getUniqueIMEIID 不是 abel this context ,当我调用 getContext(this) 时给出错误image from android studio
public static String getUniqueIMEIId(Context context) {
TelephonyManager telephonyManager = (TelephonyManager)
context.getSystemService(Context.TELEPHONY_SERVICE);
...
String imei = telephonyManager.getDeviceId();
...
}
【问题讨论】:
-
你的 getUniqueIMEIId 方法是什么?是你自己的方法还是第三个库?
标签: java android android-studio android-layout contextmenu