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.