1

I'm newbie at android programing. I have read many interesting driving direction application. so, I tried to build map and gps based application.

I can get and show direction between 2 point , but I don't know how to show textual instruction like

https://i.stack.imgur.com/7i7ei.jpg

Can somebody help me out? Or give me toturial? Thank for you kindness

congtuyenvip
  • 11
  • 1
  • 4

1 Answers1

2

This api gives you an information about the route steps:

http://maps.googleapis.com/maps/api/directions/json?origin=&destination=&sensor=true&alternatives=true&units=metric;

Parse the JSON, create listActivity and put the data in it.That is all

P.S.

http://code.google.com/apis/maps/documentation/directions/#DirectionsRequests

Plamen Nikolov
  • 4,177
  • 3
  • 23
  • 24
  • Thank Pepi for your reply. But the question is that when I do request like google example:http://maps.googleapis.com/maps/api/directions/json?origin=Chicago,IL&destination=Los+Angeles,CA&waypoints=Joplin,MO|Oklahoma+City,OK&sensor=false then I received json output, I had "html_instructions": "Head \u003cb\u003enorth\u003c/b\u003e on \u003cb\u003eS Morgan St\u003c/b\u003e toward \u003cb\u003eW Cermak Rd\u003c/b\u003e", So how do i know which list item tell user turn left, right...? Should I have dictionary to recognize this? – congtuyenvip Jul 17 '11 at 09:34
  • For my question in my comment, I have known the answer. So Thank Pepi for your kindness. Now I'm trying to show the instruction icon up when received xml response from google map api: Turn right onto Hang Buom for this I want to show turn_right_icon.png and Turn left onto Hang Buom I want to show turn_left_icon.png. But how can I do that by code? – congtuyenvip Jul 22 '11 at 10:32
  • Use regex. Search for the string you want - Turn left or Turn right. :) – Plamen Nikolov Jul 22 '11 at 10:37
  • Thank Pepi again. You are very good person if you give regex example for clearly such as I find direction from California, United States to Los Angeles, CA and instruction are: Terrace Ave turns slightly left and becomes Tivy Valley Rd, Turn right onto N Piedra Rd etc . I know that there are many direction key words and icons, how can I to be sure that all things in my application? – congtuyenvip Aug 05 '11 at 15:23