I'm trying to get a Json from a web resource and convert it to string to show it on the screen. I am using android Studio for this and I can not consume that resource. Any idea that is wrong PS: In the manifests I have added the INTERNET and ACCESS_NETWORK_STATE permissions.
public void getData(String URL) throws Exception {
URL url = new URL(URL);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
JsonReader reader = new JsonReader(new InputStreamReader(in, "UTF-8"));
reader.beginArray();
while (reader.hasNext()){
text.concat(reader.nextString());
}
}