0

How to get current location in different language.Do we need to add some libraries?I need to find the current address in arabic language? I think there is google maps in arabic format.Similarily is there any way to get current address in arabic lamguage??

public static final String GOOGLE_GEOCODER = "http://maps.googleapis.com/maps/api/geocode/json?latlng=";

public static String getAddressFromGPSData(double lat, double longi) {
    HttpRetriever agent = new HttpRetriever();
    String request = GOOGLE_GEOCODER + lat + ","
            + longi + "&sensor=true";
    // Log.d("GeoCoder", request);
    String response = agent.retrieve(request);
    String formattedAddress = "";
    if (response != null) {
        Log.d("GeoCoder", response);
        try {
            JSONObject parentObject = new JSONObject(response);
            JSONArray arrayOfAddressResults = parentObject
                    .getJSONArray("results");
            JSONObject addressItem = arrayOfAddressResults.getJSONObject(0);
            formattedAddress = addressItem.getString("formatted_address");
        } catch (JSONException e) {

            e.printStackTrace();
        }

    }

    // Log.d("GeoCoder", response);
    return formattedAddress;
}
Hari Sankar
  • 197
  • 2
  • 15

1 Answers1

0

You need to "Localize" the Map.

for example:

Locale.setDefault(new Locale("ja"));

will show Japanese.

It may or may not be possible to do it for Arabic. List doesn't mention it as a supported language.

Ashesh
  • 3,499
  • 1
  • 27
  • 44
  • i want formatted address in arabic language...in this google api [link](https://maps.googleapis.com/maps/api/geocode/json?latlng=8.558419,76.881584&sensor=true&language=ar) – Hari Sankar Apr 16 '15 at 13:01
  • Yes It does support arabic Locale.setDefault(new Locale("ar")); – Adnan Sep 08 '16 at 06:58