I am doing an Asynctask function that reads from json file. I want that on postExecute pass like string contact´s "nombre, categoria, hora, lugar..." to another Activity that I have. How can I get contact´s values on postExecute? Somebody can help me? This is my code
private class GetProgramaSC extends AsyncTask<Void, Void, Void> {
@Override
protected void onPreExecute() {
super.onPreExecute();
// Showing progress dialog
pDialog = new ProgressDialog(getActivity());
if(idioma.equalsIgnoreCase("es")){
pDialog.setMessage("Por favor espere...");
}
else{
pDialog.setMessage("Itxaron mesedez...");
}
pDialog.setCancelable(false);
pDialog.show();
}
@Override
protected Void doInBackground(Void... arg0) {
try {
JSONObject jsonObj = new JSONObject(loadJSONFromAsset());
// Getting JSON Array node
eventos = jsonObj.getJSONArray("results");
// looping through All Contacts
for (int i = 0; i < eventos.length(); i++) {
JSONObject c = eventos.getJSONObject(i);
String categoria = c.getString(TAG_CATEGORIA);
String nombre = c.getString(TAG_NOMBRE);
String hora = c.getString(TAG_HORA);
String lugar = c.getString(TAG_LUGAR);
String fecha = c.getString(TAG_FECHA);
String coordenadas = c.getString(TAG_COORDENADAS);
String info = c.getString(TAG_INFO);
String imagen= c.getString(TAG_IMAGEN);
// tmp hashmap for single contact
HashMap<String, String> contact = new HashMap<String, String>();
// adding each child node to HashMap key => value
contact.put("categoria", categoria);
contact.put("nombre", nombre);
contact.put("hora", hora);
contact.put("nombre_lugar", lugar);
contact.put("fecha", fecha);
contact.put("coordenadas", coordenadas);
contact.put("info", info);
contact.put("imagen", imagen);
// adding contact to contact list
eventosList.add(contact);
}
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
// Dismiss the progress dialog
if (pDialog.isShowing())
pDialog.dismiss();
}
}
Thank you so much