I am reading a JSON from the web, After parsing my JSON, I have loaded the data in an array in order to use them, my question is, how can I pass this data in another activity to fill a list ..
my code ..
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
String url = "http://www.air-intra.com/apps/air-app/agregar.php?token=" + dato + "&codiart=" + cod + "";
HttpHandler she = new HttpHandler();
JSONObject jsonStr = she.makeServiceCall(url);
Log.e("CODEXES", String.valueOf(jsonStr));
try {
JSONObject jsonObj = new JSONObject(String.valueOf(jsonStr));
JSONArray contacts = jsonObj.getJSONArray("PRR");
// prod.clear();
for (int i = 0; i < contacts.length(); i++) {
JSONObject c = contacts.getJSONObject(i);
String codig = c.getString("codigo");
String des = c.getString("descrip");
String prec = c.getString("precio");
String reglon = c.getString("renglon");
HashMap<String, String> contacto = new HashMap<>();
contacto.put("codigo", codig);
contacto.put("descrip", des);
contacto.put("precio", prec);
contacto.put("renglon", reglon);
// reg = "" + reglon;
productos.add(contacto);
} }catch(JSONException e){
e.printStackTrace();
}
and in the onPostExecute I want to send the data of the array in a list of the other activity
@Override
protected void onPostExecute(Void aVoid) {
// Log.d("RESULTADO", toString());
Intent intent = new Intent(busqueda.this,Carrito.class);
// What can I do ...
startActivity(intent);
super.onPostExecute(aVoid);
}