【发布时间】:2017-11-27 13:45:42
【问题描述】:
如何将此代码 sn-p 重写为不产生 java.lang.NullPointerException 的形式?
Intent bank_Amount_Intent = getIntent();
Bundle bundle = bank_Amount_Intent.getExtras();
double buyin_Money = bundle.getDouble("buyin", 0);
total = buyin_Money;
bank_Amount.setText(String.valueOf(currency_Format.format(buyin_Money)));
【问题讨论】:
-
在尝试访问其成员之前实例化变量,或添加空检查
标签: java android nullpointerexception