on every launch of android application, it creates new instances of variables? -
i creating application in want beep on change of preset value accelerometer when toggle switch on.
but problem is, if exit app when toggle switch on, , on next launch beeps twice, , beeps once if toggle switch off.
how can rid of issue?
button1.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { // todo auto-generated method stub if(flg1==false) { stat.settext("status: on"); flg1=true; } else { stat.settext("status : off"); flg1=false; } } }); // public void onsensorchanged(sensorevent event) { deltax = event.values[0]; deltay = event.values[1]; deltaz = event.values[2]; //after changes delta values if(flg1==true &&(deltax>=thresh||deltay>=thresh||deltay>=thresh)) { if(mp1.isplaying()) { //do nothing } else { mp1.start(); toast.maketext(getapplicationcontext(), "playing beep", toast.length_short).show(); } }
Comments
Post a Comment