Ver Mensaje Individual
  #1  
Viejo 28/01/17, 18:41:35
Array

[xs_avatar]
Joakin60 Joakin60 no está en línea
Miembro del foro
 
Fecha de registro: oct 2015
Mensajes: 64
Tu operador: Movistar

Pasar variable ArrayList<String> a doInBackground

Quiero pasar la variable pidList del tipo ArrayList<String> a doInBackground de una clase que extiende de AsyncTask llamada ActualizarFavoritos. Para ello hago lo siguiente:

if (pidList!=null){
new ActualizarFavoritos().execute(pidList);
}

Y en la clase ActualizarFavoritos:
class ActualizarFavoritos extends AsyncTask<ArrayList<String>, String, String> {
@override
protected void onPreExecute() {

}
protected String doInBackground(ArrayList<String>... args) {
ArrayList<String> pidListpassed = args[0];
HashMap<String, ArrayList<String>> params = new HashMap<String, ArrayList<String>>();
params.put("pidList", pidListpassed);
JSONObject json = jParser.makeHttpRequest(url_favoritos, "POST", params);
try {
//SUCCESS TAG
int success = json.getInt(TAG_SUCCESS);
if (success == 1) {

}
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
protected void onPostExecute(String result) {
pDialog.dismiss();
}
Y me da error al ejecutar la aplicación. En el log pone:
Caused by: java.lang.NullPointerException
En la línea que corresponde a: int success = json.getInt(TAG_SUCCESS);
Llevo dándole vueltas un tiempo y no encuentro donde me equivoco. Agradecería a quién me pudiera orientar.
Responder Con Cita