android - Toggle-button pause/resume current activity -


i created button, want if click on it, app pause till click again should resume @ same point. i've tried use onpause() hasn't effect app.

   @override public void oncheckedchanged(compoundbutton buttonview, boolean ischecked) {     if (ischecked) {          method should paused!      } else {          method should resumed!     }  } 

i've method has tts , timecounter. want add pause/resume button. have no idea how can handle it.

you have understand how activity life cycle works. please read android manual. can't call onpause/onresume activity directly

onpause : called when system start resuming previous activity. typically used commit unsaved changes persistent data, stop animations , other things may consuming cpu, etc.

onresume : called when activity start interacting user.

please read http://developer.android.com/reference/android/app/activity.html


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -