I was building an enquiry to google's direction service, but the execute method crashed halfway, Here's the code
Uri.Builder b = Uri.parse("http://maps.googleapis.com/maps/api/directions/json").buildUpon();
b.appendQueryParameter("origin", "The University of Hong KOng");
b.appendQueryParameter("destination", "Lee Hysan Hall");
b.appendQueryParameter("sensor", "false");
b.appendQueryParameter("language", "en_US");
String finalstr = b.build().toString();
URI googledirectionservice = new URI(finalstr);
HttpGet mRequest = new HttpGet(googledirectionservice);
HttpClient mClient = new DefaultHttpClient();
response = mClient.execute(mRequest);
The url constructed is fine when I access it from my browser, but it wouldn't work accessed from the HttpClient.You can double check with
http://maps.googleapis.com/maps/api/directions/json?origin=The%20University%20of%20Hong%20KOng&destination=Lee%20Hysan%20Hall&sensor=false&language=en_US
What would be the reason? Besides, how can I make the debugging information more informative? The current ones in logcat showed nothing more than
threadid=... thread exiting with uncaught exception