Android: Set interval in SeekBar -
in application have seekbar
shown in dialog. wanna set interval , step in seekbar
. interval should 0-250 , each step should 5 minutes.
so far code:
public class seekactivity extends activity implements onclicklistener, onseekbarchangelistener { seekbar seekbar; button button; textview textview; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); //set main content view setcontentview(r.layout.main); //this button show dialog button button1main = (button) findviewbyid(r.id.button01main); button1main.setonclicklistener(this); } public void onclick(view v) { //set dialog dialog dialog = new dialog(this); dialog.setcontentview(r.layout.maindialog); dialog.settitle("this custom dialog box"); dialog.setcancelable(true); button = (button) dialog.findviewbyid(r.id.button01); seekbar = (seekbar) dialog.findviewbyid(r.id.seekbar1); seekbar.setonseekbarchangelistener(this); textview = (textview) dialog.findviewbyid(r.id.textview1); dialog.show(); } public class seekbarpreference { } @override public void onprogresschanged(seekbar seekbar, int progress, boolean fromuser) { // todo auto-generated method stub textview.settext(progress + ""); } @override public void onstarttrackingtouch(seekbar seekbar) { // todo auto-generated method stub } @override public void onstoptrackingtouch(seekbar seekbar) { // todo auto-generated method stub }; }
could give me tips/code how do?
thanks!
instead of doing why not set max value of seekbar 50 (250/5) , whatever conversion necessary seekbar values "real" values?
Comments
Post a Comment