android


How to set time range using seekbar


I stumbled upon this library by Anothem. Basically it provides a SeekBar similar to the default Android one, but with two thumb controls allowing a range to be selected, and some other extras as well.
As at the moment the seekbar can select range between numbers/digits but cannot be used for actual time range selection in 12 hours system like 12am-3pm.
I am tring to achieve the above but with no success.
After looking through stackoverflow i stumbled again at a similar issue but cannot seem to reuse or implement for my case.
Similarly a github repo promised to solve the issue but after running the class, i simply cannot see the changes.
Any suggestions will be highly appreciated!
Here is the class to modify.
How i used it:
RangeSeekBar rangeSeekBar = (RangeSeekBar) findViewById(R.id.seekbar);
rangeSeekBar.setRangeValues(15, 90);
rangeSeekBar.setSelectedMinValue(20);
rangeSeekBar.setSelectedMaxValue(88);
Why are you setting the range values from 15 to 90? If you are trying to depict time, you should set the range values as:
rangeSeekBar.setRangeValues(0,24 * SMALLEST_HOUR_FRACTION);
where SMALLEST_HOUR_FRACTION is the smallest block of time you can select (2 to select every half hour, 4 for every quarter hour (15 minutes), 60 for every minute).
Then, to determine the time the user selected, use:
int minHour = rangeSeekBar.getSelectedMinValue() / SMALLEST_HOUR_FRACTION;
int minMinute = SMALLEST_HOUR_FRACTION * (rangeSeekBar.getSelectedMinValue() % SMALLEST_HOUR_FRACTION);
int maxHour = rangeSeekBar.getSelectedMaxValue() / SMALLEST_HOUR_FRACTION;
int maxMinute = SMALLEST_HOUR_FRACTION * (rangeSeekBar.getSelectedMaxValue() % SMALLEST_HOUR_FRACTION);

Related Links

How can i get the nearest location by using google map api in android?
Issues while image downloading
Handle synchronisation of data between Android Service and Server via REST API
Android - stackoverflow Error
Sorting ListBiew by Spinner in android?
PhoneGap speed vs native iOS 4/5 and Android for GPS / Location Services / Maps
I want toast message to be displayed when alarm rings for android
ClassCastException (Gallery + ImageView)
read contacts in android
Is it possible to use sub folders in drawables in Android? [duplicate]
How to run an android app in background?
How to make an executable out of my LIBGDX game
WebView & Soft keyboard Issue
write and read configuration data using File operation in Android
how to maximize CPU usage in Android
Fetch the updated call log and store it in a file

Categories

HOME
httparty
assembly
gdb
alexa-skills-kit
solaris
parameters
zip
bookmarks
nstableheaderview
performancepoint
google-chrome-app
mel
enthought
3nf
scrolltop
glyphicons
scsi
symfony-2.8
digital-signature
lilypond
articulate-storyline
springfox
question2answer
ckfinder
opentk
android-things
rpgle
jaws
sqlpackage
mockjax
simplecv
papaparse
linkedhashmap
hard-drive
gnat-gps
pop3
jwplayer6
xajax
searchkit
openerp-7
sql-server-ce
git-rewrite-history
dm-script
ideascript
sessionstorage
filesystemwatcher
urlsession
datacachefactory
x++
cnc
google-cse
context-sensitive-grammar
java-websocket
template-toolkit
smartfoxserver
cronexpression
pytables
lrs
signalr.client
macaulay2
embedding
stream-processing
project-organization
contentcontrol
phpgrid
spring-retry
linklabel
jdi
opserver
binomial-theorem
skspritenode
git-ftp
kubuntu
cosine-similarity
sip-server
contrast
device-tree
jqmodal
reflector
menubar
koala
amslidemenu
flex++
preload
curb
redis-py
jquery-blockui
web-farm
cakephp-1.2
denied
winmain
cac
resharper-6.0
globals
zend-rest
escrow
sqlobject
information-management
wcf-proxy
netbeans6.1

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App