How to update the image of each ImageView of a ListView in Android with new image for each one
<p>I am fetching texts first and adding them to the ListView (This part is working).
Then for each item in the ListView I am fetching an image and need to add this image to the ImageView of each item which is already defined in the layout.
I am able to get all the images but don't know how to update the ListView with the same.</p>

<pre><code>//AsyncTask For texts.
private class pgData extends AsyncTask&lt;String, String, JSONArray&gt; {
    protected JSONArray doInBackground(String... params) {
        publishProgress("Starting");
        String result=null;
        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost("http://xxx.xxx/xxx.php");
        HttpResponse response = null;
        HttpEntity httpentity =null;
        JSONArray t=null;
        try{
            response= httpclient.execute(httppost);
            httpentity=response.getEntity();
            result= EntityUtils.toString(httpentity);
            t=new JSONArray(result);
        }catch (Exception e){
            publishProgress(e.toString());
            this.cancel(true);
        }
        return  t;
    }
    protected void onProgressUpdate(String... i) {
        Toast.makeText(getBaseContext(), i[0], Toast.LENGTH_SHORT).show();
    }

    protected void onPostExecute(JSONArray result) {
            String x[];
            l = result.length();
            pg_data = new pg[l];
            JSONObject jsonObject;
            for (int i = 0; i &lt; l; i++) {
                try {
                    jsonObject = result.getJSONObject(i);
                    x[0] = jsonObject.getString("xxx");
                    x[1]=jsonObject.getString("xxx");
                    x[2] = jsonObject.getString("xxxx");
                    x[3] = jsonObject.getString("rentMonthly");
                    pg_data[i] = new pg(
                            x[0],
                            x[1],
                            x[2],
                            x[3]
                    );
                    jdata.add(xxx_data[i]);
                } catch (Exception e) {
                    Toast.makeText(getBaseContext(), e.toString(), Toast.LENGTH_LONG).show();
                }
            }
            adapter = new pgAdapter(second.this,
                    R.layout.pg,
                    xxx_data);
            lv = (ListView) findViewById(R.id.listView);
            lv.setAdapter(adapter);
            new xxImage().execute(); //exexuting async task for fetching images.
    }
}

//Async Task for fetching images
private class xxImage extends AsyncTask&lt;String, String, JSONArray&gt; {
    protected JSONArray doInBackground(String... params) {
        publishProgress("Getting Images");
        String result=null;
        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost("http://xxx.xx/xx.php");
        HttpResponse response = null;
        HttpEntity httpentity =null;
        JSONArray t=null;
        try{
            response= httpclient.execute(httppost);
            httpentity=response.getEntity();
            result= EntityUtils.toString(httpentity);
            t=new JSONArray(result);
        }catch (Exception e){
            publishProgress(e.toString());
            this.cancel(true);
        }
        return  t;
    }
    protected void onProgressUpdate(String... i) {
        Toast.makeText(getBaseContext(), i[0], Toast.LENGTH_SHORT).show();
    }
    protected void onPostExecute(JSONArray result) {
            String image1;
            l = result.length();
            xx_image = new xxImage[l];
            JSONObject jsonObject;
            for (int i = 0; i &lt; l; i++) {
                try {
                    jsonObject = result.getJSONObject(i);
                    image1 = "\n" + jsonObject.getString("image1") + "\n";
                    xx_image[i] = new xxImage(
                            image1
                    );
                    jimage.add(xx_image[i]);
                } catch (Exception e) {
                    Toast.makeText(getBaseContext(), e.toString(), Toast.LENGTH_LONG).show();
                }
            }
            //I got all the Images in 'jimage'. Now how to update the ListView from here?
        }
    }
</code></pre>