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

in gridview adapter class imageview set wrap content the images are blink while running in android?
How to manage a hash key in facebook for adroid app?
No resource identifier found referenced in external library AAR
How can I return bitmap from AsyncTask?
I would like to create a reset password activity in android with help of firebase [closed]
how to find that the Android app is 32bit or 64bit
How do I send push notification on Android depending on the data from a REST API using Firebase? [closed]
RecyclerView nested two horizontal RecyclerView, slide the second horizontal RecyclerView and report a NullPointerException
How to parametrize options of a menu on Android?
Challenge task in Android Pie Chart?
Groovy invokes adb command to pull a file but the new file is invisible
Dynamically added EditTexts focus goes from first to last when keyboard next button is clicked
Android : Click event is not triggered at time of animation
Galaxy S3 screen blackout layout not inflating but click actions are working
Android WebView Blocked a frame with origin
Move the layout as the user swipes the layout from right to left and dismiss it after few seconds with animation in android

Categories

HOME
beautifulsoup
adal
angular-formly
spring-data-redis
sublimetext
tivoli
interpolation
x264
missing-data
mvc5
jtextpane
lanczos
character
discrete-mathematics
rcloud
fosrestbundle
commonjs
mel
dynatrace
internationalization
jmp
sencha-touch
asp.net-core-webapi
drive
guzzle
imagemap
pagespeed
r-mice
pimcore
qliksense
jquery-callback
perlbrew
mount
itunes
maze
corpus
android-things
tpm
exchangewebservices
tizen-tv
calculation
custom-controls
mobx
testbed
memory-address
catch-unit-test
dsx-desktop
biztalk-rule-engine
lubridate
cd
ideascript
tex
android-augmented-reality
google-data-api
plaintext
skylink
chronicle-map
http-request
tcc
photos
memory-mapping
phpdbg
xbmc
builder
openrasta
activeperl
x-ray
singleinstance
opengl-4
bootstrap-tags-input
cvxpy
omxplayer
watch-os-2
mongodb-php
model-associations
dup
appscale
aurora
lz77
pushbots
np-spring
morton-number
extjs-grid
binomial-theorem
evolus-pencil
finalbuilder
code-documentation
cosine-similarity
boost-program-options
genymotion-call
paw
jama
mdichild
ora-00904
rcaller
malformedurlexception
gnumeric
paste
xmltodict
embedded-fonts
kogrid
time.h
actiondispatch
font-awesome-4.0.0
virtual-pc
asplinkbutton
curb
redis-py
qtconcurrent
cakephp-1.2
fusefabric
jdb
cross-database
apache-commons-dbutils
pinch
multiplatform
mbeans
timthumb
collectionviewsource
non-clustered-index
ajax-polling
isapi-extension
qtabbar
asynchronous-wcf-call
dsoframer
mathematical-typesetting
commercial-application
pnrp

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