Java Android , Httpget Error - Host Name May Not Be Null
Solution 1:
Did you encode URI? For example remove spaces or other special characters that break stuff? Try android.net.Uri.encode(String s)
HttpGet mHttpGet = new HttpGet(new URI(null,android.net.Uri.encode(item.getImageUrl()),null));
Best way to debug this to always print the URL and analyze the ones that give an error.
Solution 2:
I think you are using the wrong constructor. The three argument URI constructor has this signature:
public URI(String scheme, String ssp, String fragment)
but you are providing a URL as the 2nd argument rather than an SSP. I think you should be using the one argument constructor that takes a URL string as its argument.
Solution 3:
Well there was no Java or Android problem, it results that the server changes the request when it comes from a device...
Solution 4:
Please try a host name without the use of hyphens "-" or underscores "_", see if it works .
Post a Comment for "Java Android , Httpget Error - Host Name May Not Be Null"