try {
String URLName = "http://www.sample.com";
String line,res = "";
HttpURLConnection con = (HttpURLConnection) new URL(URLName).openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
while ((line = in.readLine()) != null){
res=res+line;
}
}
catch (Exception e) {
e.printStackTrace();
}
by the end, I get "" from res on my friend's android 4.x but it runs fine on my emulator and when I use the browser on my friend's phone to open the site: www.sample.com then my app works again until we restart the phone