android - if loop inside if loop -
here code having problem with.
if (adi == 1) { if (rs >= 10) system.out.println("oooooooo"); { // todo codes incomplete system.out.println("ohhhhh"); vib2.vibrate(600); mediaplayer mp = mediaplayer.create(getbasecontext(), r.raw.beep02); mp.start(); } finish(); } the problem don’t check rs>=10 play mp , vibrate . rs = 0 . not getting out put "ooooooo" getting "ohhhhh" . don’t want play mp , vibrate if rs < 10 .
any appreciated .
if m not wrong committing silly mistake...
if (adi == 1) { system.out.println("oooooooo"); if (rs >= 10) { system.out.println("ohhhhh"); vib2.vibrate(600); mediaplayer mp = mediaplayer.create(getbasecontext(), r.raw.beep02); mp.start(); } else finish(); } if compare code thing did move system.out.println("oooooooo"); above if(rs>=10) since said system.out.println("oooooooo"); printing means rs working consuming printing "ooooo" . system.out.println () statement , line of code .and since rs consumed hence code including mediaplayer called independantly of rs condition.
btw think should calling finish in else
hope helps... thx
Comments
Post a Comment