Implementing android custom progress bar -
i'm new in android development , wanted know if can give me suggestion how implement somthing this.
i want implement custom progress bar this , want able somthing after progress bar passing each 1 of vertical lines , number of vertical lines should customizable programmatically. somthing play specific sound or display specific toast or anything.
sorry if question dumb , time.
update:
lets say, progress based on time in seconds , lines equal numbers of seconds. example whole progress in 40s , lines in 10th, 20th , 30th seconds.
you can set max value of progress bar:
progressbar.setmax(4); // or whatever number of notches want
edit : sleep 1000 milliseconds (1 second), , update progress bar. keep updating until reaches max value.
private void startprogressthread() { new thread(new runnable() { @override public void run() { while (progressbar.getprogress() < progressbar.getmax()) { // wait 1 second thread.sleep(1000); progressbar.post(new runnable() { @override public void run() { progressbar.setprogress(progressbar.getprogress() + 1); // show toast or play sound. toast.maketext(getapplicationcontext(), "it's been " + progressbar.getprogress() + " seconds.", toast.length_short).show(); } }); } } }).start(); }
Comments
Post a Comment