Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to call arraylist in another activity using AsyncTask- Android app
    primarykey
    data
    text
    <p>I have an application where I have a separate class named "Images1" which extends AsyncTask, where in I am fetching all the gallery URL via JSON.I am instantiating the AsyncTask class in another activity where I need the arraylist returned by the "Images1" class.However I am unable to get the arraylist. Please suggest what steps should be taken.Thanks in advance </p> <pre><code>public class Images1 extends AsyncTask&lt;Void, Void, ArrayList&lt;String&gt;&gt; { ProgressDialog mPreogressDialog; private static String url = "http://www.tts.com/album_pro/array_to_encode"; JSONParser jParser = new JSONParser(); ArrayList&lt;String&gt; image_urls = new ArrayList&lt;String&gt;(); @Override protected void onPreExecute() { mPreogressDialog = ProgressDialog.show(Images1.this, "", "Uploading Document. Please wait...", true); } @Override protected ArrayList&lt;String&gt; doInBackground(Void... params) { // TODO Auto-generated method stub //Do your stuff here call ur methods imagedownload(); return image_urls; } protected void onPostExecute(ArrayList&lt;String&gt; result) { super.onPostExecute(result); // TODO Auto-generated method stub if (mPreogressDialog.isShowing()) mPreogressDialog.dismiss(); } public void imagedownload(){ JSONObject json = jParser.getJSONFromUrl(url); try{ JSONObject seo = json.getJSONObject("SEO"); JSONArray folio = seo.getJSONArray("Folio"); JSONArray image_urls1 = new JSONArray(); String s1=seo.getString("Folio"); for(int i=0;i&lt;folio.length();++i) { String m = folio.getString(i); Log.v("M"+i,m); image_urls.add(m+ ","); } } catch(Exception e) { e.printStackTrace(); } } } </code></pre> <p>In the another activity I am instantiating the class and calling it as </p> <pre><code>Images1 img1; new img1.execute(); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload