I have a valid URL, but I cannot parse its content to a string like I do in normal Java. I am pretty new to android. Mostly I convert my normal Java code to android Java and this code works perfectly in Java NetBeans but not in Android Studio.
P.S.There are no errors or even warnings given by compiler / during run-time. It just doesn't work and when I check the String length for "weather" its 0.
String weather="";
try {
weather = new Scanner(new URL("http://api.openweathermap.org/data/2.5/forecast?lat="+lat+"&lon="+longi+"&units=metric&mode=xml").openStream(), "UTF-8").useDelimiter("\\A").next();
} catch (Exception e) {
}