Keep in mind that GregorianCalendar is actually quite heavy from a Java perspective. In fact, you will probably see a few-second delay when first creating it, as it reads heavy timezone data from disk.
The android.text.format.Time class was designed to provide much of the same functionality, but at a *much* lower cost. Even though SimpleDateFormat is very flexible, it's also costly on a mobile device. If you can make assumptions about your input data, using the parsers provided by Time is much more efficient. Here's an snippet of code where I manually inserted milliseconds to make a RFC 3339-compliant string, which then parses very efficiently: http://code.google.com/p/android-sky/source/browse/trunk/Sky/src/org/jsharkey/sky/webservice/NoaaSource.java#88 j On Thu, May 14, 2009 at 7:47 AM, mirko <[email protected]> wrote: > > I think, the class GregorianCalendar provides all information you are > looking for (getFirstDayOfWeek). This class will take care of your > locale, because the first day of the week is not the same all over the > world. > > I also use SimpleDateFormat very often to make conversions between > String and Date. > > Mirko > > On 14 Mai, 10:01, Jeff Sharkey <[email protected]> wrote: >> You're probably looking for something like Time.weekDay, which you can >> get at through Time.setToNow(): >> >> http://d.android.com/reference/android/text/format/Time.html#weekDay >> >> From that weekDay, you can also get a localized string through >> DateUtils.getDayOfWeekString(). Here's a quick example where I used >> it to generate the correct string ("Mon", "Wed", etc.) based on a >> given UTC time: >> >> http://code.google.com/p/android-sky/source/browse/trunk/Sky/src/org/... >> >> j >> >> On Thu, May 14, 2009 at 12:01 AM, daehoon <[email protected]> wrote: >> >> > Hi, all >> > There is a string, it's value is "5-14-2009". >> > we know 14 is Wed, so 12 is Monday. This week is begin by 12(Mon.). >> > How to get first day of week, when we know one of the date in the >> > week? >> >> -- >> Jeff Sharkey >> [email protected] > > > -- Jeff Sharkey [email protected] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

