Using times on the Android platform.

Posted by Tarmon on Stack Overflow See other posts from Stack Overflow or by Tarmon
Published on 2010-04-22T15:20:03Z Indexed on 2010/04/22 15:23 UTC
Read the original article Hit count: 644

Filed under:
|

Hey Everyone,

I have a lot of time information in the format of hh:mm and I was wondering if there is a good way to take this information and compare it to the current time. Say I have a list of times for a day and I want to find out which time in this array of strings is the first that has not already past in this day.

I was looking at the Calender API and I figured I could break the strings up into hours and minutes by splitting it at the ":" and then create a calender object from that but that seems rather inefficient.

Just looking for some input; thanks, Rob

<string-array name="example">
    <item>6:58</item>
    <item>7:41</item>
    <item>8:08</item>
    <item>8:28</item>
    <item>8:48</item>
    <item>9:08</item>
    <item>9:43</item>
    <item>10:13</item>
    <item>10:43</item>
    <item>11:13</item>
    <item>11:43</item>
    <item>12:09</item>
    <item>12:29</item>
    <item>12:49</item>
    <item>1:09</item>
    <item>1:29</item>
    <item>1:49</item>
    <item>2:09</item>
    <item>2:29</item>
    <item>2:49</item>
    <item>3:09</item>
    <item>3:29</item>
    <item>3:49</item>
    <item>4:09</item>
    <item>4:29</item>
    <item>4:49</item>
    <item>5:09</item>
    <item>5:29</item>
    <item>5:49</item>
    <item>6:29</item>
    <item>7:09</item>
    <item>7:47</item>
    <item>8:27</item>
    <item>9:07</item>
    <item>9:47</item>
    <item>10:27</item>
</string-array>

© Stack Overflow or respective owner

Related posts about android

Related posts about android-sdk