Force stopped | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Force stopped

what is the reason for force stopped. I wrote an if statement for button but when there is nothing to do it will crash.

28th Nov 2016, 2:53 AM
amin ahrami
amin ahrami - avatar
3 Answers
0
could you please post the code so others can halp debug it.
28th Nov 2016, 3:38 AM
Junjie Gono
Junjie Gono - avatar
0
public void cheak (View v){ String gn =edcheak.getText().toString(); int gnn = Integer.parseInt(gn); String nc =String.valueOf(gnn); edcheak.setText(""); if(gnn == zotopia){ tvcheak.setText("" + "«" + zotopia + "»" + ""); }else if (gnn > zotopia){ tvcheak.setText(""); }else if (gnn < zotopia){ tvcheak.setText(""); }else if(zotopia == 0){ Toast.makeText(this , "." ,Toast.LENGTH_SHORT).show(); } }
28th Nov 2016, 3:53 AM
amin ahrami
amin ahrami - avatar
0
if the EditText is empty when you click the button it will crash
28th Nov 2016, 3:54 AM
amin ahrami
amin ahrami - avatar