[android-developers] Re: Problem in SimpleDateFormat MMM return month number

2010-09-14 Thread Mathieu - gpmoo7
I had the same issue trying to parse this date string: Sat, 04 Sep
2010 01:50:17 +
with this: SimpleDateFormat(EEE, dd MMM  HH:mm:ss ).
That was working perfectly on Android 2.2.

I tried the app on a non-english Android 1.5 device and that didn't
work any more.
I fixed my problem by forcing the English locale like this:
SimpleDateFormat(EEE, dd MMM  HH:mm:ss , Locale.ENGLISH)
Now the date string is parsed correctly on Android 1.5 and 2.2 (I
assume any 1.5+).

Hope it helps someone else.

12% are still using Android 1.5 ;(

Mathieu

On Aug 9, 5:05 am, mot12 martin.hu...@gmail.com wrote:
 I had similar problems and have been using
 android.text.format.DateFormat instead:
 DateFormat.format(EEE, cal)

 Martinwww.mobitobi.com
 Gentle Alarm
 Sleep Now!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Problem in SimpleDateFormat MMM return month number

2010-09-14 Thread Fabrizio Giudici

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 9/13/10 00:32 , Mathieu - gpmoo7 wrote:
 Hope it helps someone else.

 12% are still using Android 1.5 ;(
I can confirm that there's a locale problem on some gear with 1.5.

- -- 
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - We make Java work. Everywhere.
java.net/blog/fabriziogiudici - www.tidalwave.it/people
fabrizio.giud...@tidalwave.it
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyPKVIACgkQeDweFqgUGxfesACgiiK17W9UqZVVzwsSySc2iL11
1xYAnidP9OPhT0krt14DOc8ZCLSxvSAZ
=yJRa
-END PGP SIGNATURE-

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Problem in SimpleDateFormat MMM return month number

2010-08-09 Thread mot12
I had similar problems and have been using
android.text.format.DateFormat instead:
DateFormat.format(EEE, cal)

Martin
www.mobitobi.com
Gentle Alarm
Sleep Now!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Problem in SimpleDateFormat MMM return month number

2010-08-07 Thread Tim Su
I had one of my users perform the following tests. They have an HTC
Desire running Froyo and have the locale set to French.

new SimpleDateFormat(, d ).format(new Date())
new SimpleDateFormat(, d , Locale.FRENCH).format(new Date())
new SimpleDateFormat(, d , Locale.getDefault()).format(new
Date())
new SimpleDateFormat(, d ,
getResources().getConfiguration().locale).format(new Date())

Each time, the return string is the same: 7, 7 8

Both Locale.getDefault() and the configuration locale are set to
French (France) (fr_FR)

Pretty busted, if you ask me... does anyone know of a workaround that
doesn't involve manually sticking days/weekdays into strings.xml?

On Aug 6, 5:08 am, DanH danhi...@ieee.org wrote:
 Right.  What I was suggesting was to try setting locale in order to
 test the hypothesis that lack of a locale is causing the symptoms, vs,
 eg, something broken in the date formatter logic.  And it would
 provide a circumvention for those who need one.

 On Aug 6, 4:37 am, { Devdroid } webnet.andr...@gmail.com wrote:



  On 5 August 2010 14:53, DanH danhi...@ieee.org wrote:

   Has anyone tried doing Locale.setDefault to circumvent thisproblem?

  Theproblemis when you do not care what locale are set and simply
  want to use system-wide, not any particular one.
  Calling setDefault is same like passing locale to SimpleDateFormater
  constructor - you need to either specify locale or read system
  settings and pass that in hope it works. Since this is like blind fix
  it may or may not work but you still do not know what the culprit is.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Problem in SimpleDateFormat MMM return month number

2010-08-07 Thread DanH
Interesting.  This suggests that something is broken in the actual
Java JDK stuff.

On Aug 7, 6:32 pm, Tim Su t...@todoroo.com wrote:
 I had one of my users perform the following tests. They have an HTC
 Desire running Froyo and have the locale set to French.

 new SimpleDateFormat(, d ).format(new Date())
 new SimpleDateFormat(, d , Locale.FRENCH).format(new Date())
 new SimpleDateFormat(, d , Locale.getDefault()).format(new
 Date())
 new SimpleDateFormat(, d ,
 getResources().getConfiguration().locale).format(new Date())

 Each time, the return string is the same: 7, 7 8

 Both Locale.getDefault() and the configuration locale are set to
 French (France) (fr_FR)

 Pretty busted, if you ask me... does anyone know of a workaround that
 doesn't involve manually sticking days/weekdays into strings.xml?

 On Aug 6, 5:08 am, DanH danhi...@ieee.org wrote:

  Right.  What I was suggesting was to try setting locale in order to
  test the hypothesis that lack of a locale is causing the symptoms, vs,
  eg, something broken in the date formatter logic.  And it would
  provide a circumvention for those who need one.

  On Aug 6, 4:37 am, { Devdroid } webnet.andr...@gmail.com wrote:

   On 5 August 2010 14:53, DanH danhi...@ieee.org wrote:

Has anyone tried doing Locale.setDefault to circumvent thisproblem?

   Theproblemis when you do not care what locale are set and simply
   want to use system-wide, not any particular one.
   Calling setDefault is same like passing locale to SimpleDateFormater
   constructor - you need to either specify locale or read system
   settings and pass that in hope it works. Since this is like blind fix
   it may or may not work but you still do not know what the culprit is.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Problem in SimpleDateFormat MMM return month number

2010-08-06 Thread { Devdroid }
On 5 August 2010 14:53, DanH danhi...@ieee.org wrote:
 Has anyone tried doing Locale.setDefault to circumvent this problem?

The problem is when you do not care what locale are set and simply
want to use system-wide, not any particular one.
Calling setDefault is same like passing locale to SimpleDateFormater
constructor - you need to either specify locale or read system
settings and pass that in hope it works. Since this is like blind fix
it may or may not work but you still do not know what the culprit is.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Problem in SimpleDateFormat MMM return month number

2010-08-06 Thread DanH
Right.  What I was suggesting was to try setting locale in order to
test the hypothesis that lack of a locale is causing the symptoms, vs,
eg, something broken in the date formatter logic.  And it would
provide a circumvention for those who need one.

On Aug 6, 4:37 am, { Devdroid } webnet.andr...@gmail.com wrote:
 On 5 August 2010 14:53, DanH danhi...@ieee.org wrote:

  Has anyone tried doing Locale.setDefault to circumvent this problem?

 The problem is when you do not care what locale are set and simply
 want to use system-wide, not any particular one.
 Calling setDefault is same like passing locale to SimpleDateFormater
 constructor - you need to either specify locale or read system
 settings and pass that in hope it works. Since this is like blind fix
 it may or may not work but you still do not know what the culprit is.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Problem in SimpleDateFormat MMM return month number

2010-08-05 Thread DanH
Has anyone tried doing Locale.setDefault to circumvent this problem?

On Aug 5, 7:15 am, { Devdroid } webnet.andr...@gmail.com wrote:
 On 3 August 2010 13:30, Mark Murphy mmur...@commonsware.com wrote:

  We got same problem on Desire, so it looks like device firmware issue.

  Somebody with a Desire should create a sample project demonstrating
  the error and open an issue on b.android.com -- not to fix the problem
  (that's an HTC issue), but to get a new CTS test case added to prevent
  this problem in the future. Plus, given the test project, we can try
  other HTC devices and see if the problem exists on the EVO,
  Incredible, etc.

 Code is is quite simple.

 Date date = 

 SimpleDateFormat formatter = new SimpleDateFormat();

 formatter.applyLocalizedPattern(  );
  = formatter.format( date );

 the issue is with , EEE,  and MMM (in general all localised)

 But what I now spotted, that this code no longer works on 1.5
 emulator, even it worked yesterday. Quite impressive - we will
 investigate the culprit.

 Work around is simple, just instance SimpleDateFormat with specified
 locale (i.e. SimpleDateFomat(, Locale.) but this is not what
 shall be done in the first place. Anyone else facing this?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Problem in SimpleDateFormat MMM return month number

2010-08-02 Thread DanH
I would be suspicious that the application is not finding its locale
information, and is therefore defaulting to non-textual data.

On Aug 2, 5:05 pm, Thierry Legras tleg...@gmail.com wrote:
 Hi Sasikumar,

 Could you find a solution to this problem?
 I have been reported same issue on HTC Desire 2.2 new update and also
 on some custom ROM.
 The format i use is this one:

     final static SimpleDateFormat sDisplayDayFormat = new
 SimpleDateFormat( d M);

 and later set it in a textvierw like this:

     tv.setText(sDisplayDayFormat.format(someDate))

 Instead of day and month name, i got 2 numbers (obviously day number
 in week, and month number in year)

 Thanks,
 Thierry.

 2010/4/30, Sasikumar.S sasikumar.it1...@gmail.com:



  Hi,,

  when we are using simpledateformat MMM it should return month abbrevation.
  Example :- If it is a june month it should return jun.
  But in my program it returns 6 . That is month number.
  I created my program 3 days before. Till today morning i did not got any
  error in that.
  Today morning only i faced this problem .
  I don't know why?..
  Any one faced this problem..

  --
  Thanks  Regards
  Sasikumar.S

  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 --
 Thierry.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Problem in SimpleDateFormat MMM return month number

2010-08-02 Thread Sasikumar.S
@Thierry
Till Now I didn't got any solution for this.

On Aug 3, 3:05 am, Thierry Legras tleg...@gmail.com wrote:
 Hi Sasikumar,

 Could you find a solution to this problem?
 I have been reported same issue on HTC Desire 2.2 new update and also
 on some custom ROM.
 The format i use is this one:

     final static SimpleDateFormat sDisplayDayFormat = new
 SimpleDateFormat( d M);

 and later set it in a textvierw like this:

     tv.setText(sDisplayDayFormat.format(someDate))

 Instead of day and month name, i got 2 numbers (obviously day number
 in week, and month number in year)

 Thanks,
 Thierry.

 2010/4/30, Sasikumar.S sasikumar.it1...@gmail.com:



  Hi,,

  when we are using simpledateformat MMM it should return month abbrevation.
  Example :- If it is a june month it should return jun.
  But in my program it returns 6 . That is month number.
  I created my program 3 days before. Till today morning i did not got any
  error in that.
  Today morning only i faced this problem .
  I don't know why?..
  Any one faced this problem..

  --
  Thanks  Regards
  Sasikumar.S

  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 --
 Thierry.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Problem in SimpleDateFormat MMM return month number

2010-04-30 Thread Kumar Bibek
You would have changed your code. Do have a look.

Thanks and Regards,
Kumar Bibek

On Apr 30, 4:40 pm, Sasikumar.S sasikumar.it1...@gmail.com wrote:
 Hi,,

 when we are using simpledateformat MMM it should return month abbrevation.
 Example :- If it is a june month it should return jun.
 But in my program it returns 6 . That is month number.
 I created my program 3 days before. Till today morning i did not got any
 error in that.
 Today morning only i faced this problem .
 I don't know why?..
 Any one faced this problem..

 --
 Thanks  Regards
 Sasikumar.S

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group 
 athttp://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en