Java tutorial
//package com.java2s; import android.content.Context; public class Main { /** * Build url for route calculation * * @param fromLat start point latitude * @param fromLon start point longitude * @param toLat destination point latitude * @param toLon destination point longitude * @param context current context * @return route url for Google Maps service */ public static String getUrl(double fromLat, double fromLon, double toLat, double toLon, Context context) {// connect to map web service final StringBuilder urlString = new StringBuilder(); final String currentLanguage = context.getResources().getConfiguration().locale.getLanguage(); urlString.append("http://maps.googleapis.com/maps/api/directions/json?language="); urlString.append(currentLanguage); //current language urlString.append("&origin=");// from urlString.append(Double.toString(fromLat)); urlString.append(","); urlString.append(Double.toString(fromLon)); urlString.append("&destination=");// to urlString.append(Double.toString(toLat)); urlString.append(","); urlString.append(Double.toString(toLon)); urlString.append("&ie=UTF8&mode=driving&sensor=true"); return urlString.toString(); } }