Reputation: 496
I am getting a warning Argument amountTarget might be null
. Is there any way to ignore this warning?
if (betid != null) {
String betnumber = mData.get(i).get("betnumber");
String amountTarget = mData.get(i).get("amountTarget");
holder.tx_amount.setText(amountTarget);
holder.tx_number.setText(betnumber);
holder.checkBox.setChecked(true);
//getting warning argument exception on amountTarget
int x = Integer.parseInt(amountTarget) * amountX - deductAmount;
holder.tx_counter.setText(x);
}
Upvotes: 0
Views: 539
Reputation: 8191
check that amountTarget isn't null by doing one of these:
if(amountTarget != null){
int x = Integer.parseInt(amountTarget) * amountX - deductAmount;
}
or initialize the variable to something before using it, for example
amountTarget = 0
int x = Integer.parseInt(amountTarget) * amountX - deductAmount;
alternatively you could also do something like this
if (amountTarget == null){
amountTarget = 0
}
Upvotes: 1