@Override
protected Boolean doInBackground(Void... params) {
for(int i=1; i<=10; i++) {
tareaLarga();
publishProgress(i*10);
}
HttpResponse resp = httpClient.execute(url);
String respStr = EntityUtils.toString(resp.getEntity());
JSONArray respJSON = new JSONArray(respStr);
String[] peliculas = new String[respJSON.length()];
for(int i=0; i<respJSON.length(); i++){
JSONObject obj = respJSON.getJSONObject(i);
String titLib = obj.getString("libro");
String isbnLib = obj.getString("isbn");
peliculas[i] = titLib + " - " + isbnLib;
}
ArrayAdapter<String> adaptador =
new ArrayAdapter<String>(Peliculas.this,
android.R.layout.simple_list_item_1, peliculas);
lstPeliculas.setAdapter(adaptador);
return true;
}
