I get the error "host name may not be null error " in my Android app.
This is my code:
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost("http://sub_domain.domain.com/service/api");
httpost.setHeader("Accept", "application/json");
httpost.setHeader("Content-type", "application/json");
ResponseHandler responseHandler = new BasicResponseHandler();
try {
httpclient.execute(httpost, responseHandler);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
I use a sub-domain so I can't put 'www' in my url because it's another sub domain. I have Internet permission in my manifest file.
Any suggestions? Thanks!
Edit : It's impossible to access to this url with a GET method.
Without '_' in my subdomain, it's okay.