i can not convert from string to int after pass the variable from another activity in android studio | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

i can not convert from string to int after pass the variable from another activity in android studio

String nowy=getIntent().getExtras().getString("yearbrith"); int BRITHYEAR=Integer.parseInt(nowy);

10th Jan 2018, 12:52 AM
ALAMOUDI, WAEL MAKKI S
ALAMOUDI, WAEL MAKKI S - avatar
1 Answer
+ 1
The problem is Parsing? You must use try and catch String nowy = getIntent().getExtras().getString("yearbrith"); try{ int BRITHYEAR = Integer.parseInt(nowy); }catch( NumberFormatException e){ //anything to display } Greetings :D
11th Jan 2018, 3:38 AM
jaaxdev
jaaxdev - avatar