これは私の活動です。画像が表示されません。URLが画像ビューに設定されています。
private ImageLoader testing;
testing = new ImageLoader(this);
imageview = (ImageView)findViewById(R.id.image_alllatestnewstitle);
...
...
...
これは複数の画像を表示するためです。
private void filldata() {
lv = (ListView) findViewById(android.R.id.list);
String[] from = new String[] { "particularlatestnewstitle",
"newscategorytitle", "newsdate" };
int[] to = new int[] { R.id.text_particularlatestnewstitle,
R.id.text_newscategorytitle, R.id.text_newsdate };
fillMaps = new ArrayList<HashMap<String, String>>();
for (int i = 0; i < webservice.news.size(); i++) {
HashMap<String, String> map = new HashMap<String, String>();
map.put("particularlatestnewstitle", webservice.news.get(i)
.getNtitle());
map.put("newscategorytitle", webservice.news.get(i).getNewCatName());
map.put("newsdate", webservice.news.get(i).getNArticalD());
fillMaps.add(map);
imageview = (ImageView)findViewById(R.id.image_alllatestnewstitle);
imageview.setTag(imagepath[i]);
testing.DisplayImage(imagepath[i], imageview);
}
SimpleAdapter adapter = new SimpleAdapter(this, fillMaps,
R.layout.main_alllatestnewslist, from, to);
lv.setAdapter(adapter);
これはこれは私が
url and bitmap
ヌルどちらもない結果を印刷して、正しいURLが表示されたXMLレイアウト
<ImageView
android:id="@+id/image_alllatestnewstitle"
android:layout_width="134px"
android:layout_height="80px"
android:layout_marginBottom="5px"
android:layout_marginLeft="10px"
android:layout_marginRight="10px"
android:layout_marginTop="5px"
android:scaleType="centerCrop" />
にある
public void DisplayImage(String url, ImageView imageView)
{
imageViews.put(imageView, url);
Bitmap bitmap=memoryCache.get(url);
if(bitmap!=null){
System.out.println(url.toString());
System.out.println(bitmap.toString());
imageView.setImageBitmap(bitmap);
}else
{
queuePhoto(url, imageView);
}
}
私ImageLoaderクラスですリンク。
しかし、setimagebitmapを実行してもエラーは発生しませんでしたが、画像ビューも画像を表示しませんでした。
何が問題ですか?
p/s:必要に応じて、より多くのコードをリクエストしてください。
ImageLoaderにはこの機能がありません。 –
@AlanLai FYIの組み込み関数です。 –
どのようにそれを呼び出すには? それは 'imageview.setTag(のImagePath [i])と –