Tuesday, 15 March 2011

java - IF else statement function -



java - IF else statement function -

i have code of if else statement

@override public void onclick(view arg0) { int aint = integer.parseint(textview1.gettext().tostring()); if(aint <= 0) { toast.maketext(getapplicationcontext(), "wrong", toast.length_short).show(); } else{ int a=integer.parseint(textview1.gettext().tostring()); int b=a-2; string s1 = string.valueof(b); textview1.settext(s1); toast.maketext(getapplicationcontext(), "wrong", toast.length_short).show(); int c =integer.parseint(textview5.gettext().tostring()); int d = c-1; string s2 = string.valueof(d); textview5.settext(s2); } if(textview5 != null) { int dint = integer.parseint(textview5.gettext().tostring()); if(dint <= 0); toast.maketext(getapplicationcontext(), "game over", toast.length_short).show(); intent intent = new intent(); intent.setclass(mainactivity.this, fifth.class); startactivity(intent); savepreferences("mem1", textview1.gettext().tostring()); } } };

on part of code want start intent if value of textview5 0 still goes new intent value of textview5 not yet 0 don`t know part of code wrong:

} if(textview5 != null) { int dint = integer.parseint(textview5.gettext().tostring()); if(dint <= 0); toast.maketext(getapplicationcontext(), "game over", toast.length_short).show(); intent intent = new intent(); intent.setclass(mainactivity.this, fifth.class); startactivity(intent); }

if(textview5 != null) { int dint = integer.parseint(textview5.gettext().tostring()); if(dint <= 0) { toast.maketext(getapplicationcontext(), "game over",toast.length_short).show(); startactivity(new intent(mainactivity.this, fifth.class)); } }

java if-statement syntax

No comments:

Post a Comment