I have trying to connect a application to web services that retrieves a JSON, but return JSONException
My code:
private class LlenarDatosReproduccion extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... urls) {
try {
return downloadUrl(urls[0]);
} catch (IOException e) {
return "Ups! Error.Parece que la url es inválida";
}
}
@Override
protected void onPostExecute(String result) {
try {
JSONObject responseJSON = new JSONObject(result.toString());
JSONArray cancionJSON = responseJSON.getJSONArray("cancion");
tvTitle.setText(cancionJSON.getString(1));
//tvArtist.setText(cancionJSON.getString(2));
} catch (JSONException e) {
e.printStackTrace();
}
super.onPostExecute(result);
}
}
Please look the Logcat image