I'm trying to read JSON data form a URL, and currently i got this code snippet inside my onCreate method in my MainActivity class:
try {
URL url = new URL("https://bugzilla.mozilla.org/rest/bug/35");
try{
InputStream in = url.openStream();
JsonReader reader = new JsonReader(new InputStreamReader(in));
// more will be there...
} catch (IOException e) {
e.printStackTrace();
}
} catch (MalformedURLException e) {
e.printStackTrace();
}
When I run the app on a virtual device, it says that the program is stopped, it can't even start it. Maybe I'm trying to read the data in a wrong way. The most important thing, is that I want to read JSON data from URL. I also added the INTERNET permission to the aplication, but it didn't help.