Re: [android-developers] Re: How to replace the ItemizedOverlay with onTap event

2013-03-13 Thread Edward Lin
I will have a try and let you know the results.

Thanks!




On Wed, Mar 13, 2013 at 3:25 AM, Martin warwo...@gmail.com wrote:

 Can you use the InfoWindowAdapter and override it's GetInfoContent handler
 to supply your own custom View and in that custom View create the clickable
 Views you require?


 https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/GoogleMap.InfoWindowAdapter#getInfoContents%28com.google.android.gms.maps.model.Marker%29

 Martin.



 On Tuesday, March 12, 2013 9:29:00 PM UTC, elin wrote:

 According to the following link: https://developers.**
 google.com/maps/documentation/**android/v1/mapkeyhttps://developers.google.com/maps/documentation/android/v1/mapkey

 *Note*: Version 1 of the Google Maps Android API as been officially
 deprecated as of December 3rd, 2012. *This means that from March 3rd,
 2013 you will no longer be able to request an API key for this version.* No
 new features will be added to Google Maps Android API v1. However, apps
 using v1 will continue to work on devices. Existing and new developers are
 encouraged to use Google Maps Android API 
 v2https://developers.google.com/maps/documentation/android/
 .

 So I am trying to migrate my Android Map API to Google Map API V2. My Map
 application was using ItemsizedOverlay with onTap event so that user can
 click the Overlay on different links, views or buttons to navigate to the
 destination or close the BalloonItem if user click the close button. But on
 API v2, the ItemizedOverlay is replaced as InfoWindow.  As a result, any
 listeners you set on the InfoWindow are disregarded and you cannot
 distinguish between click events on various parts of the view.

 I cannot believe migrate to Map API v2 is going to reduce the features of
 the Map application. Those features are something I cannot use without it.
 Can anyone let me know any alternative for getting onTap (or onClick)
 listener for the InfoWindow? Or what other control can provide the similar
 feature for InfoWindow.

 Many thanks!

  --
 --
 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
 ---
 You received this message because you are subscribed to the Google Groups
 Android Developers group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to android-developers+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Re: How to replace the ItemizedOverlay with onTap event

2013-03-13 Thread Edward Lin
I can supply the custom view, the views have the autolink for phone or
email, but when I click the InfoWindow, it raised as whole InfoWindow
event. Here is the codes I revised from a post by Commonware. Any light?

public class TaskMapV2 extends FragmentActivity implements
OnInfoWindowClickListener {
  private static final String STATE_NAV=nav;
  private static final int[] MAP_TYPE_NAMES= { R.string.normal,
  R.string.hybrid, R.string.satellite, R.string.terrain };
  private static final int[] MAP_TYPES= { GoogleMap.MAP_TYPE_NORMAL,
  GoogleMap.MAP_TYPE_HYBRID, GoogleMap.MAP_TYPE_SATELLITE,
  GoogleMap.MAP_TYPE_TERRAIN };
  private GoogleMap map=null;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

  setContentView(R.layout.map_fragement);

  SupportMapFragment mapFrag=

(SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map);


  map=mapFrag.getMap();

  if (savedInstanceState == null) {
CameraUpdate center=
CameraUpdateFactory.newLatLng(new LatLng(40.76793169992044,
 -73.98180484771729));
CameraUpdate zoom=CameraUpdateFactory.zoomTo(15);

map.moveCamera(center);
map.animateCamera(zoom);
  }

  addMarker(map, 40.748963847316034, -73.96807193756104, A place,
Place Name);

  map.setInfoWindowAdapter(new MapPopupAdapter(getLayoutInflater()));
  map.setOnInfoWindowClickListener(this);

  }

  @Override
  public void onSaveInstanceState(Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);

  }

  @Override
  public void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);

  }

  @Override
  public void onInfoWindowClick(Marker marker) {
Toast.makeText(this, marker.getTitle(), Toast.LENGTH_LONG).show();
  }

  private void addMarker(GoogleMap map, double lat, double lon,
 int title, int snippet) {
map.addMarker(new MarkerOptions().position(new LatLng(lat, lon))
 .title(getString(title))
 .snippet(getString(snippet)));
  }

  private void addMarker(GoogleMap map, double lat, double lon,
  String title, String snippet) {
   map.addMarker(new MarkerOptions().position(new LatLng(lat, lon))
  .title(title)
  .snippet(snippet));
  }
}

public class MapPopupAdapter implements InfoWindowAdapter {
  LayoutInflater inflater=null;

  public MapPopupAdapter(LayoutInflater inflater) {
this.inflater=inflater;
  }

  @Override
  public View getInfoWindow(Marker marker) {
return(null);
  }

  @Override
  public View getInfoContents(Marker marker) {
View popup=inflater.inflate(R.layout.map_overlay_view, null);

TextView tv=(TextView)popup.findViewById(R.id.item_title);
tv.setText(marker.getTitle());

TextView snippet = (TextView)popup.findViewById(R.id.item_snippet);
snippet.setText(marker.getSnippet());

TextView phone = (TextView)popup.findViewById(R.id.item_phone);
phone.setText(262-347-5678);

return(popup);
  }
}

map_overlay_view
?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/android;
android:layout_width=wrap_content
android:layout_height=wrap_content
android:orientation=horizontal
android:paddingBottom=35dip
android:paddingLeft=10dip
android:minWidth=200dip
android:id=@+id/balloon_main_layout
android:paddingTop=0dip
android:paddingRight=0dip
LinearLayout
android:layout_width=wrap_content
android:layout_height=wrap_content
android:orientation=vertical
android:layout_weight=1
android:paddingTop=10dip
android:id=@+id/balloon_inner_layout
TextView android:layout_height=wrap_content
android:layout_width=fill_parent
android:id=@+id/item_title
android:text=@string/item_title
android:textSize=16sp
android:textColor=#FF00/TextView
TextView android:layout_height=wrap_content
android:layout_width=fill_parent
android:id=@+id/item_snippet
android:text=@string/item_snippet
android:textSize=16sp
android:textColor=#FF00/TextView
TextView android:layout_height=wrap_content
android:layout_width=fill_parent
android:id=@+id/item_phone
android:text=@string/item_phone
android:textSize=16sp
android:autoLink=phone
android:textColor=#FF00/TextView
TextView android:layout_height=wrap_content
android:layout_width=fill_parent
android:id=@+id/item_email
android:text=@string/balloon_item_email
android:autoLink=email
android:textSize=16sp/TextView
/LinearLayout
ImageView android:layout_width=wrap_content
android:layout_height=wrap_content
android:src=@drawable/icon_close_32
android:id=@+id/close_img_button
android:paddingLeft=12dip
android:paddingBottom=12dip
android:paddingRight=6dip
android:paddingTop=6dip/ImageView
/LinearLayout

Many Thanks!




On Wed, Mar 13, 2013 at 2:34 PM, Edward Lin edwardlinw

Re: [android-developers] Re: How to replace the ItemizedOverlay with onTap event

2013-03-13 Thread Edward Lin
Thanks for information! That sounds like Google Map API V2 is way more
complicated than V1 if developers try to use a popup to show information
and execute different events.

If I am using RelativeLayout to position the popup over the marker, is
there any way I can get the location of the marker on the mapFragement when
I click the marker?

Regards,




On Wed, Mar 13, 2013 at 3:55 PM, Mark Murphy mmur...@commonsware.comwrote:

 You define views for the InfoWindow, but that's not what is rendered
 on the screen, AFAIK. Instead, the views appear to be converted into a
 bitmap, presumably by drawing them into a bitmap-backed Canvas. My
 assumption is that this is due to the inter-process communication
 between the Maps V2 library in our apps and the Play Services
 Framework, and their collaboration on actually assembling the map.

 You are welcome, presumably, to put your own widgets over top of the
 map, by putting the Map in a RelativeLayout, FrameLayout, etc., though
 I have not tried this.


 On Wed, Mar 13, 2013 at 4:47 PM, Edward Lin edwardlinw...@gmail.com
 wrote:
  I can supply the custom view, the views have the autolink for phone or
  email, but when I click the InfoWindow, it raised as whole InfoWindow
 event.
  Here is the codes I revised from a post by Commonware. Any light?
 
  public class TaskMapV2 extends FragmentActivity implements
  OnInfoWindowClickListener {
private static final String STATE_NAV=nav;
private static final int[] MAP_TYPE_NAMES= { R.string.normal,
R.string.hybrid, R.string.satellite, R.string.terrain };
private static final int[] MAP_TYPES= { GoogleMap.MAP_TYPE_NORMAL,
GoogleMap.MAP_TYPE_HYBRID, GoogleMap.MAP_TYPE_SATELLITE,
GoogleMap.MAP_TYPE_TERRAIN };
private GoogleMap map=null;
 
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
 
setContentView(R.layout.map_fragement);
 
SupportMapFragment mapFrag=
 
 
 (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map);
 
 
map=mapFrag.getMap();
 
if (savedInstanceState == null) {
  CameraUpdate center=
  CameraUpdateFactory.newLatLng(new LatLng(40.76793169992044,
 
  -73.98180484771729));
  CameraUpdate zoom=CameraUpdateFactory.zoomTo(15);
 
  map.moveCamera(center);
  map.animateCamera(zoom);
}
 
addMarker(map, 40.748963847316034, -73.96807193756104, A place,
  Place Name);
 
map.setInfoWindowAdapter(new MapPopupAdapter(getLayoutInflater()));
map.setOnInfoWindowClickListener(this);
 
}
 
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
  super.onSaveInstanceState(savedInstanceState);
 
}
 
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
  super.onRestoreInstanceState(savedInstanceState);
 
}
 
@Override
public void onInfoWindowClick(Marker marker) {
  Toast.makeText(this, marker.getTitle(), Toast.LENGTH_LONG).show();
}
 
private void addMarker(GoogleMap map, double lat, double lon,
   int title, int snippet) {
  map.addMarker(new MarkerOptions().position(new LatLng(lat, lon))
   .title(getString(title))
   .snippet(getString(snippet)));
}
 
private void addMarker(GoogleMap map, double lat, double lon,
String title, String snippet) {
map.addMarker(new MarkerOptions().position(new LatLng(lat, lon))
.title(title)
.snippet(snippet));
}
  }
 
  public class MapPopupAdapter implements InfoWindowAdapter {
LayoutInflater inflater=null;
 
public MapPopupAdapter(LayoutInflater inflater) {
  this.inflater=inflater;
}
 
@Override
public View getInfoWindow(Marker marker) {
  return(null);
}
 
@Override
public View getInfoContents(Marker marker) {
  View popup=inflater.inflate(R.layout.map_overlay_view, null);
 
  TextView tv=(TextView)popup.findViewById(R.id.item_title);
  tv.setText(marker.getTitle());
 
  TextView snippet = (TextView)popup.findViewById(R.id.item_snippet);
  snippet.setText(marker.getSnippet());
 
  TextView phone = (TextView)popup.findViewById(R.id.item_phone);
  phone.setText(262-347-5678);
 
  return(popup);
}
  }
 
  map_overlay_view
  ?xml version=1.0 encoding=utf-8?
  LinearLayout xmlns:android=http://schemas.android.com/apk/res/android;
  android:layout_width=wrap_content
  android:layout_height=wrap_content
  android:orientation=horizontal
  android:paddingBottom=35dip
  android:paddingLeft=10dip
  android:minWidth=200dip
  android:id=@+id/balloon_main_layout
  android:paddingTop=0dip
  android:paddingRight=0dip
  LinearLayout
  android:layout_width=wrap_content
  android:layout_height=wrap_content
  android:orientation=vertical

[android-developers] How to replace the ItemizedOverlay with onTap event

2013-03-12 Thread Edward Lin
According to the following link:
https://developers.google.com/maps/documentation/android/v1/mapkey

*Note*: Version 1 of the Google Maps Android API as been officially
deprecated as of December 3rd, 2012. *This means that from March 3rd, 2013
you will no longer be able to request an API key for this version.* No new
features will be added to Google Maps Android API v1. However, apps using
v1 will continue to work on devices. Existing and new developers are
encouraged to use Google Maps Android API
v2https://developers.google.com/maps/documentation/android/
.

So I am trying to migrate my Android Map API to Google Map API V2. My Map
application was using ItemsizedOverlay with onTap event so that user can
click the Overlay on different links, views or buttons to navigate to the
destination or close the BalloonItem if user click the close button. But on
API v2, the ItemizedOverlay is replaced as InfoWindow.  As a result, any
listeners you set on the InfoWindow are disregarded and you cannot
distinguish between click events on various parts of the view.

I cannot believe migrate to Map API v2 is going to reduce the features of
the Map application. Those features are something I cannot use without it.
Can anyone let me know any alternative for getting onTap (or onClick)
listener for the InfoWindow? Or what other control can provide the similar
feature for InfoWindow.

Many thanks!

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Re: Java.Text.DateFormat returns wrong pattern for en-GB in Android 4.0.x

2012-07-05 Thread Edward Lin
That is correct. It happened on my Samsung Nexus 2 and ASUS Eee Pad (All
those testing devices are using platform 4.0.x). Some other phones like
Motorola Atrix (2.3.6) displayed date with en-GB correctly. All of those
devices are purchased from US.

As I mentioned in the previous email, the Code in my App is:

Locale currentLocale = Locale.*getDefault*(); // at this point, the setting
is using en-GB
dateFormatter = DateFormat.getDateInstance(**Dat**eFormat.SHORT,
currentLocale);
String formattedDateString = dateFormatter.format(new
Date(System.currentTimeMillis()));

 The Date Format should be SHORT for all locales. I just try to use a
generic way to handle the date time localization.

Thanks,

Edward

On Wed, Jul 4, 2012 at 12:11 AM, Zsolt Vasvari zvasv...@gmail.com wrote:

 So are saying that if you go to Settings (NOT your code) and pick the
 Great Britain language setting, the phone shows all dates in US English
 format?


 On Wednesday, July 4, 2012 12:21:42 AM UTC+8, elin wrote:

 The getAvailableLocales returned en-GB locale. So the en-GB should be
 available on this Samsung device and I can switch it through Settings.
 In addition, if I choose the other locale on the 4.0.x devices through
 the Settings, such as Deutsch. It is working perfectly as date shown
 03.07.2012, so what is wrong with en-GB?

 Thanks,

 Edward

 On Tue, Jul 3, 2012 at 10:56 AM, Edward Lin edwardlinw...@gmail.comwrote:

 Thanks for the reply! Here is the results I got from this line of code:

 Locale[] allLocales = Locale.getAvailableLocales();

 [ar, ar_AE, ar_BH, ar_DZ, ar_EG, ar_IQ, ar_JO, ar_KW, ar_LB, ar_LY,
 ar_MA, ar_OM, ar_QA, ar_SA, ar_SD, ar_SY, ar_TN, ar_YE, bg, bg_BG, ca,
 ca_ES, cs, cs_CZ, da, da_DK, de, de_AT, de_BE, de_CH, de_DE, de_LI, de_LU,
 el, el_GR, en, en_AU, en_BE, en_BW, en_BZ, en_CA, en_GB, en_HK, en_IE,
 en_IN, en_JM, en_MH, en_MT, en_NA, en_NZ, en_PH, en_PK, en_RH, en_SG,
 en_TT, en_US, en_US_POSIX, en_VI, en_ZA, en_ZW, es, es_AR, es_BO, es_CL,
 es_CO, es_CR, es_DO, es_EC, es_ES, es_GT, es_HN, es_MX, es_NI, es_PA,
 es_PE, es_PR, es_PY, es_SV, es_US, es_UY, es_VE, fa, fa_AF, fa_IR, fi,
 fi_FI, fil, fil_PH, fr, fr_BE, fr_CA, fr_CH, fr_FR, fr_LU, fr_MC, iw,
 iw_IL, hi, hi_IN, hr, hr_HR, hu, hu_HU, in, in_ID, it, it_CH, it_IT, ja,
 ja_JP, ko, ko_KR, lt, lt_LT, lv, lv_LV, nb, nb_NO, nl, nl_BE, nl_NL, pl,
 pl_PL, ps, pt, pt_BR, pt_PT, rm, ro, ro_RO, ru, ru_RU, ru_UA, sk, sk_SK,
 sl, sl_SI, sr, sv, sv_FI, sv_SE, th, th_TH, tr, tr_TR, uk, uk_UA, vi,
 vi_VN, zh, zh_CN, zh_HK, zh_HANS, zh_HANS_CN, zh_HANS_HK, zh_HANS_SG,
 zh_HANT, zh_HANT_HK, zh_HANT_MO, zh_HANT_TW, zh_MO, zh_SG, zh_TW]



 On Tue, Jul 3, 2012 at 10:43 AM, RichardC richard.critten@googlemail.**
 com richard.crit...@googlemail.com wrote:

 Reading a bit further I found  getAvailableLocales ()

 http://developer.android.com/**reference/java/util/Locale.**
 html#getAvailableLocales()http://developer.android.com/reference/java/util/Locale.html#getAvailableLocales()

 Try that and see what it returns.


 On Tuesday, July 3, 2012 4:25:38 PM UTC+1, elin wrote:

 Please help me with this date time localization issue. I am trying to
 use Java.Text.DateFormat to get the default date format for different
 locale in the following.

 dateFormatter = DateFormat.getDateInstance(**Dat**eFormat.SHORT,
 Locale.UK);
 String formattedDateString = dateFormatter.format(new
 Date(System.currentTimeMillis()));

 When I am trying to format the date using en-GB locale for the date
 - July, 3rd, 2012

 Android 2.2.x.-2.3.x result: 03/07/2012  (Correct)
 Android 4.0.x result: 07/03/2012  (Wrong)

 Apparently, It is working at Android platform 2.2.x to 2.3.x, but in
 devices with 4.0.x (such as ASUS Eee Pad and Samsung Nexus 2), it does not
 work anymore. Why is this behavior different between the API level? And 
 how
 can I get the default date format for specific locale from now on?

 Thanks,

 Edward

  --
 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 android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+**unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/android-developers?hl=enhttp://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


-- 
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

[android-developers] Java.Text.DateFormat returns wrong pattern for en-GB in Android 4.0.x

2012-07-03 Thread Edward Lin
Please help me with this date time localization issue. I am trying to use
Java.Text.DateFormat to get the default date format for different locale in
the following.

dateFormatter = DateFormat.getDateInstance(DateFormat.SHORT, Locale.UK);
String formattedDateString = dateFormatter.format(new
Date(System.currentTimeMillis()));

When I am trying to format the date using en-GB locale for the date - July,
3rd, 2012

Android 2.2.x.-2.3.x result: 03/07/2012  (Correct)
Android 4.0.x result: 07/03/2012  (Wrong)

Apparently, It is working at Android platform 2.2.x to 2.3.x, but in
devices with 4.0.x (such as ASUS Eee Pad and Samsung Nexus 2), it does not
work anymore. Why is this behavior different between the API level? And how
can I get the default date format for specific locale from now on?

Thanks,

Edward

-- 
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: Java.Text.DateFormat returns wrong pattern for en-GB in Android 4.0.x

2012-07-03 Thread Edward Lin
Thanks for the reply! Here is the results I got from this line of code:

Locale[] allLocales = Locale.getAvailableLocales();

[ar, ar_AE, ar_BH, ar_DZ, ar_EG, ar_IQ, ar_JO, ar_KW, ar_LB, ar_LY, ar_MA,
ar_OM, ar_QA, ar_SA, ar_SD, ar_SY, ar_TN, ar_YE, bg, bg_BG, ca, ca_ES, cs,
cs_CZ, da, da_DK, de, de_AT, de_BE, de_CH, de_DE, de_LI, de_LU, el, el_GR,
en, en_AU, en_BE, en_BW, en_BZ, en_CA, en_GB, en_HK, en_IE, en_IN, en_JM,
en_MH, en_MT, en_NA, en_NZ, en_PH, en_PK, en_RH, en_SG, en_TT, en_US,
en_US_POSIX, en_VI, en_ZA, en_ZW, es, es_AR, es_BO, es_CL, es_CO, es_CR,
es_DO, es_EC, es_ES, es_GT, es_HN, es_MX, es_NI, es_PA, es_PE, es_PR,
es_PY, es_SV, es_US, es_UY, es_VE, fa, fa_AF, fa_IR, fi, fi_FI, fil,
fil_PH, fr, fr_BE, fr_CA, fr_CH, fr_FR, fr_LU, fr_MC, iw, iw_IL, hi, hi_IN,
hr, hr_HR, hu, hu_HU, in, in_ID, it, it_CH, it_IT, ja, ja_JP, ko, ko_KR,
lt, lt_LT, lv, lv_LV, nb, nb_NO, nl, nl_BE, nl_NL, pl, pl_PL, ps, pt,
pt_BR, pt_PT, rm, ro, ro_RO, ru, ru_RU, ru_UA, sk, sk_SK, sl, sl_SI, sr,
sv, sv_FI, sv_SE, th, th_TH, tr, tr_TR, uk, uk_UA, vi, vi_VN, zh, zh_CN,
zh_HK, zh_HANS, zh_HANS_CN, zh_HANS_HK, zh_HANS_SG, zh_HANT, zh_HANT_HK,
zh_HANT_MO, zh_HANT_TW, zh_MO, zh_SG, zh_TW]



On Tue, Jul 3, 2012 at 10:43 AM, RichardC richard.crit...@googlemail.comwrote:

 Reading a bit further I found  getAvailableLocales ()


 http://developer.android.com/reference/java/util/Locale.html#getAvailableLocales()

 Try that and see what it returns.


 On Tuesday, July 3, 2012 4:25:38 PM UTC+1, elin wrote:

 Please help me with this date time localization issue. I am trying to use
 Java.Text.DateFormat to get the default date format for different locale in
 the following.

 dateFormatter = DateFormat.getDateInstance(**DateFormat.SHORT,
 Locale.UK);
 String formattedDateString = dateFormatter.format(new
 Date(System.currentTimeMillis(**)));

 When I am trying to format the date using en-GB locale for the date
 - July, 3rd, 2012

 Android 2.2.x.-2.3.x result: 03/07/2012  (Correct)
 Android 4.0.x result: 07/03/2012  (Wrong)

 Apparently, It is working at Android platform 2.2.x to 2.3.x, but in
 devices with 4.0.x (such as ASUS Eee Pad and Samsung Nexus 2), it does not
 work anymore. Why is this behavior different between the API level? And how
 can I get the default date format for specific locale from now on?

 Thanks,

 Edward

  --
 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


-- 
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: Java.Text.DateFormat returns wrong pattern for en-GB in Android 4.0.x

2012-07-03 Thread Edward Lin
The getAvailableLocales returned en-GB locale. So the en-GB should be
available on this Samsung device and I can switch it through Settings.
In addition, if I choose the other locale on the 4.0.x devices through the
Settings, such as Deutsch. It is working perfectly as date shown
03.07.2012, so what is wrong with en-GB?

Thanks,

Edward

On Tue, Jul 3, 2012 at 10:56 AM, Edward Lin edwardlinw...@gmail.com wrote:

 Thanks for the reply! Here is the results I got from this line of code:

 Locale[] allLocales = Locale.getAvailableLocales();

 [ar, ar_AE, ar_BH, ar_DZ, ar_EG, ar_IQ, ar_JO, ar_KW, ar_LB, ar_LY, ar_MA,
 ar_OM, ar_QA, ar_SA, ar_SD, ar_SY, ar_TN, ar_YE, bg, bg_BG, ca, ca_ES, cs,
 cs_CZ, da, da_DK, de, de_AT, de_BE, de_CH, de_DE, de_LI, de_LU, el, el_GR,
 en, en_AU, en_BE, en_BW, en_BZ, en_CA, en_GB, en_HK, en_IE, en_IN, en_JM,
 en_MH, en_MT, en_NA, en_NZ, en_PH, en_PK, en_RH, en_SG, en_TT, en_US,
 en_US_POSIX, en_VI, en_ZA, en_ZW, es, es_AR, es_BO, es_CL, es_CO, es_CR,
 es_DO, es_EC, es_ES, es_GT, es_HN, es_MX, es_NI, es_PA, es_PE, es_PR,
 es_PY, es_SV, es_US, es_UY, es_VE, fa, fa_AF, fa_IR, fi, fi_FI, fil,
 fil_PH, fr, fr_BE, fr_CA, fr_CH, fr_FR, fr_LU, fr_MC, iw, iw_IL, hi, hi_IN,
 hr, hr_HR, hu, hu_HU, in, in_ID, it, it_CH, it_IT, ja, ja_JP, ko, ko_KR,
 lt, lt_LT, lv, lv_LV, nb, nb_NO, nl, nl_BE, nl_NL, pl, pl_PL, ps, pt,
 pt_BR, pt_PT, rm, ro, ro_RO, ru, ru_RU, ru_UA, sk, sk_SK, sl, sl_SI, sr,
 sv, sv_FI, sv_SE, th, th_TH, tr, tr_TR, uk, uk_UA, vi, vi_VN, zh, zh_CN,
 zh_HK, zh_HANS, zh_HANS_CN, zh_HANS_HK, zh_HANS_SG, zh_HANT, zh_HANT_HK,
 zh_HANT_MO, zh_HANT_TW, zh_MO, zh_SG, zh_TW]



 On Tue, Jul 3, 2012 at 10:43 AM, RichardC 
 richard.crit...@googlemail.comwrote:

 Reading a bit further I found  getAvailableLocales ()


 http://developer.android.com/reference/java/util/Locale.html#getAvailableLocales()

 Try that and see what it returns.


 On Tuesday, July 3, 2012 4:25:38 PM UTC+1, elin wrote:

 Please help me with this date time localization issue. I am trying to
 use Java.Text.DateFormat to get the default date format for different
 locale in the following.

 dateFormatter = DateFormat.getDateInstance(**DateFormat.SHORT,
 Locale.UK);
 String formattedDateString = dateFormatter.format(new
 Date(System.currentTimeMillis(**)));

 When I am trying to format the date using en-GB locale for the date
 - July, 3rd, 2012

 Android 2.2.x.-2.3.x result: 03/07/2012  (Correct)
 Android 4.0.x result: 07/03/2012  (Wrong)

 Apparently, It is working at Android platform 2.2.x to 2.3.x, but in
 devices with 4.0.x (such as ASUS Eee Pad and Samsung Nexus 2), it does not
 work anymore. Why is this behavior different between the API level? And how
 can I get the default date format for specific locale from now on?

 Thanks,

 Edward

  --
 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




-- 
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