将通过url从json文件下载的图片放入列表视图?

时间:2018-08-14 00:06:10

标签: listview imageview

  protected Void doInBackground(Void... arg0) {

      //Here i have put all my data, 
      //taken from json file, in a hashmap, names, 
      //numbers, and urls that represent a photos.

  }

然后我将这个hashMap放在eventList中:

  ArrayList<HashMap<String, String>> eventList;

和onPostExecute在这里:

    @Override
    protected void onPostExecute(Void result) {
        super.onPostExecute(result);
        // Dismiss the progress dialog
        if (pDialog.isShowing())
            pDialog.dismiss();




               ListAdapter adapter = new SimpleAdapter( Home.this, 
    eventList, R.layout.list_events_linear,
                       new String[]{"name", "number"},
                       new int[]{R.id.name, R.id.number}
                       );

               lv.setAdapter(adapter);


    }

可以很好地看到姓名和号码,但是如何放置图片呢? 请帮助我。

0 个答案:

没有答案