java - Progress Bar loading according to timer -
am using timer record video in app , based on javacvrecorder app. when press screen recording starts , able see time in leftside of screen. instead of showing timer have show progress bar load according time can 1 me on don't know show progress bar. below code showing time while recording video. please me friends
private void initiaterecording(boolean isactiondown) { isrecordingstarted = true; firsttime = system.currenttimemillis(); recording = true; totalpausetime = 0; pausedtime = 0; txttimer.setvisibility(view.visible); // handler show recoding duration after recording starts mhandler.removecallbacks(mupdatetimetask); mhandler.postdelayed(mupdatetimetask, 100); btnrecordercontrol.setvisibility(view.visible); btnrecordercontrol.settext(getresources().getstring(r.string.stop)); }
use asynkctask method private void call_timerprogressbar() { //......call method first try { callprogressbar sessionrunner = new callprogressbar(getactivitytaskhandler); sessionrunner.execute(); } catch (exception ex) { } } public class callprogressbar extends asynctask<string, string, string> { handler statushandler; public callprogressbar(handler getactivitytaskhandler) { statushandler = getactivitytaskhandler; } @override protected string doinbackground(string... params) { //........call timer function } @override protected void onpreexecute() { super.onpreexecute(); progressbar.setmessage("please wait... "); progressbar.setprogressstyle(progressdialog.style_spinner); progressbar.setindeterminate(true); progressbar.setcanceledontouchoutside(false); progressbar.settitle(" "); progressbar.setcancelable(false); progressbar.show(); } @override protected void onpostexecute(string result) { try { super.onpostexecute(result); message msg = new message(); msg.obj = result; statushandler.sendmessage(msg); progressbar.dismiss(); }catch(exception ex){ } } } public handler getactivitytaskhandler = new handler() { @override public void handlemessage(message msg) { super.handlemessage(msg); progressbar.dismiss(); } };
Comments
Post a Comment