Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 16
Registered: ‎01-22-2013
My Device: Blackberry9800
My Carrier: JAZZ

NumberFormat Exception

I am working on an application, in which i want to update my balance..Actual balnce is coming from XML .. I am making another varial UpdBalance which is in string format..After Converting into Integer and calculation it is given me an error "NumberFormatException"where ever i am calling this function.. Kindly anyone help me out there..


public static String updatedBalance()
int varBal = Integer.parseInt(varBalance);
int varUpBal = Integer.parseInt(varUpdtBalance);
int res=0;
res= varBal-varUpBal;
catch(Exception e){
UiApplication.getUiApplication().pushScreen(new AgAppLoginPage());

varBalance = Integer.toString(res);
return varBalance;





Posts: 17,023
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: NumberFormat Exception

A NumberFormatException is most likely triggered by Integer.parseInt not getting a valid value.
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Posts: 15
Registered: ‎10-13-2010
My Device: 9900
My Carrier: Vodafone

Re: NumberFormat Exception

I totally agree with simon_hain. Try to check that varBalance and varUpdtBalance contain values that can be parsed to an int, or just try and catch the parseInt block.