I'm developing an android Google maps in my thesis, can i ask something about Driving Directions in Android?.
Here is my question.
"How can i generate a random driving directions in android Google maps when a button is clicked, it will randomly give the path from starting point to destination point."
Thank you!.
I asked google maps through this.
    private void parsing(GeoPoint start, GeoPoint end) throws ClientProtocolException, IOException, JSONException, URISyntaxException{
    HttpClient httpclient = new DefaultHttpClient();
    StringBuilder urlstring = new StringBuilder();
    urlstring.append("https://maps.googleapis.com/maps/api/directions/json?origin=")
    .append(Double.toString((double)start.getLatitudeE6()/1E6)).append(",").append(Double.toString((double)start.getLongitudeE6()/1E6)).append("&destination=")
    .append(Double.toString((double)end.getLatitudeE6()/1E6)).append(",").append(Double.toString((double)end.getLongitudeE6()/1E6))
    .append("&sensor=false");
    //urlstring.append("http://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal&sensor=true");
    url = new URI(urlstring.toString());
    HttpPost httppost = new HttpPost(url);
    HttpResponse response = httpclient.execute(httppost);
    HttpEntity entity = response.getEntity();
    InputStream is = null;
    is = entity.getContent();
    BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"), 8);
    StringBuilder sb = new StringBuilder();
    sb.append(reader.readLine() + "\n");
    String line = "0";
    while ((line = reader.readLine()) != null) {
        sb.append(line + "\n");
    }
    is.close();
    reader.close();
    String result = sb.toString();
    JSONObject jsonObject = new JSONObject(result);
    JSONArray routeArray = jsonObject.getJSONArray("routes");
    JSONObject routes = routeArray.getJSONObject(0);
    JSONObject overviewPolylines = routes.getJSONObject("overview_polyline");
    String encodedString = overviewPolylines.getString("points");
    List<GeoPoint> pointToDraw = decodePoly(encodedString);
    //Added line:
    mv_mapview.getOverlays().add(new RoutePathOverlay(pointToDraw));
}
Tapped on the map.
    class MapOverlay extends Overlay {
        @Override
        public boolean onTap(final GeoPoint p, MapView mapView) {
            // TODO Auto-generated method stub
            geop_Tpoint = p;
            mcon_mapcontrol = mapView.getController();
            mcon_mapcontrol.animateTo(p);
            mv_mapview.invalidate();
            longitude = (int)(p.getLongitudeE6()*1E6);
            latitude = (int)(p.getLatitudeE6()*1E6);
            new AlertDialog.Builder(ShowMap.this)
                    .setTitle("Routes")
                    .setMessage("Display Routes?")
                    .setNegativeButton("NO",
                            new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog,
                                        int which) {
                                    // TODO Auto-generated method stub
                                    textlocation.setText("Tap in the Map for Destination!");
                                    dialog.dismiss();
                                }
                            })
                    .setPositiveButton("YES",
                            new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog,
                                        int which) {
                                    // TODO Auto-generated method stub
                                    try{
                                        textlocation.setText("");
                                        parsing(geop_startpoint,geop_Tpoint);
                                        geocodeExecuter(geop_startpoint,geop_Tpoint);
                                        showButton.setEnabled(true);
                                    }catch(Exception e){
                                        textlocation.setText(""+ e.getMessage());
                                    }
                                }
                            }).show();
            showButton.setEnabled(true);
            return true;
        }
The starting point is through GPS it will give me where im I.
 
     
     
    