Okay, so I am developing a bus app that gives you the next bus on your station. On one activity I have all the buses and their times, and I just want to highlight the next bus, using the clock from the phone of the user? Is this possible?
Asked
Active
Viewed 32 times
0
-
take the time from the clock and then match it with all the bus timing using switch case and highlight the next bus timing. Use `Calendar c = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("dd:MMMM:yyyy HH:mm:ss a"); String strDate = sdf.format(c.getTime()); ` – knownUnknown Mar 23 '17 at 12:38
1 Answers
0
If you want the current time, you don't need the device clock, you can get through simple code. Just doing Calendar.getInstance()
gives you a new calendar object for the current time that takes timezone into account. From this object you can get the day, hour, minutes...
This post explains in detail how to get/use the current time
-
How can I , using the information from the clock, select a text to highlight? – angelazaff Mar 23 '17 at 13:55
-
We cannot help you more without any code on your part. Share what you've tried – Mehmet K Mar 23 '17 at 13:57