Nome do host não pode ser nulo em HttpResponse execute for android
Eu recebo o erro "O host de destino não deve ser nulo ou definido em parâmetros".
EU FAÇO ter permissão da Internet no meu arquivo de manifestoEu coloquei 'http: //' antes do meu URLEU FAÇO codifique o URLEste é o meu código:
String url = "http://maps.google.com/maps/api/directions/json?origin=1600 Pennsylvania Avenue NW, Washington, DC 20500&destination=1029 Vermont Ave NW, Washington, DC 20005&sensor=false";
HttpClient httpclient = new DefaultHttpClient();
String goodURL = convertURL(url);//change weird characters for %etc
HttpPost httppost = new HttpPost(goodURL);
HttpResponse response = httpclient.execute(httppost);
Na quinta linha (última linha acima), meu programa lança uma exceção. aqui está o erro exato:
java.lang.IllegalArgumentException: Host name may not be null
Eu codifico minha string no método convertURL ...
goodURL =http://maps.google.com/maps/api/directions/json?origin=3%20Cedar%20Ave%2c%20Highland%20Park%2c%20NJ%2008904&destination=604%20Bartholomew%20Road%2c%20Piscataway%2c%20New%20Jersey%2008854&sensor=false
Alguma sugestão? Obrigado!