ダウンロードした画像をに追加しようとしていListViewます。サーバーから画像ファイルの名前を取得することから始め、次にAsyncTaskビットマップを作成してBitmap[]配列に格納します。次に、を使用して、以下HashMapに示すデータを追加しSimpleAdapterます。リストビューにビットマップ画像を追加する方法を知りたいです。
現在、アイテムの写真をハッシュマップに入れようとした行でエラーが発生しています。どうすれば解決できますか?drawableそれらをリソースディレクトリに移動する必要がありますか?私はこれにまったく慣れていないので、ダウンロードした画像をリストビューに表示するのに役立つ情報をいただければ幸いです。これが私がデータを準備する方法です。これはすべて、onPostExecute()OIが別の非同期タスクを実行して画像ファイルを取得する非同期タスクの方法で行われます。
new AccessImages().execute("http://10.0.2.2:8000/herbivorenew/" + viewdata[2]);
List<HashMap<String,String>> aList = new ArrayList<HashMap<String,String>>();
for (int i=0;i< count; i++) {
    HashMap<String, String> hm = new HashMap<String,String>();
    hm.put("item_header", viewtext[i]);
    // built from an asynctask from the server
    hm.put("item_photo", (Bitmap)(itemphoto[i]) );
    hm.put("carrots", Integer.toString(carrotimage[i]) );
    aList.add(hm);
}
// Keys used in Hashmap
String[] from = {"item_header", "item_photo", "carrots"};
// Ids of views in listview_layout
int[] to = {R.id.item_header, R.id.item_photo, R.id.item_carrot};
// Instantiating an adapter to store each items
// R.layout.listview_layout defines the layout of each item
SimpleAdapter adapter = new SimpleAdapter(getBaseContext(), 
aList, R.layout.itemlist, from, to);
// Getting a reference to listview of main.xml layout file
ListView item_list = ( ListView ) findViewById(R.id.listitems);
item_list.setAdapter(adapter);
ダウンロードした画像は次のとおりです。
private class AccessImages extends AsyncTask<String, Void, Bitmap> {
    protected Bitmap doInBackground(String... urladds){
        return downloadImage(urladds[0]);
    }
    protected void onPostExecute(Bitmap bmp) {
        itemphoto[itemcount] = bmp;
        itemcount++;
    }
}