0
LazyListコードを使用して、外部の画像を問題なくロードしています。私は接続を必要としないアプリケーションの「ダミー」バージョンを作成しているので、すべてのファイルをローカルに持っています。どのように私は、http urlではなく、私のdrawableフォルダに格納されたローカルイメージをつかむためにこのコードをtweekするのですか?参照方法ローカルイメージ
imageLoader.DisplayImage(urls[position], mContext, vidImg_iv);
public void DisplayImage(String url, Context context, ImageView imageView)
{
imageViews.put(imageView, url);
Bitmap bitmap=memoryCache.get(url);
if(bitmap!=null) {
imageView.setImageBitmap(bitmap);
} else {
queuePhoto(url, context, imageView);
imageView.setImageResource(stub_id);
}
}
私は以下のように、このImageLoaderクラスを使用しない場合、私はメモリ不足:
if (urls[position].contains("1612802193_1625181163001_20120507051900-national")) {
vidImg_iv.setImageResource(R.drawable.national_still);
}
else if (urls[position].toString().contains("1612802193_1625188510001_20120507050000-sports")) {
vidImg_iv.setImageResource(R.drawable.sports_still);
}
else if (urls[position].toString().contains("1612802193_1625189005001_20120507050000-national-sp")) {
vidImg_iv.setImageResource(R.drawable.national_spanish_still);
}
else if (urls[position].contains("1612802193_1625255029001_20120507080000-snap")) {
vidImg_iv.setImageResource(R.drawable.snap_still);
}
else if (urls[position].contains("1612802193_1625256948001_20120507075800-breaking")) {
vidImg_iv.setImageResource(R.drawable.breaking_still);
}
else if (urls[position].contains("1612802193_1625308288001_20120507080800-vbmarguh")) {
vidImg_iv.setImageResource(R.drawable.vbmarguh_still);
}
else if (urls[position].contains("1612802193_1625308309001_20120507083200-extreme")) {
vidImg_iv.setImageResource(R.drawable.extreme_still);
}
else if (urls[position].contains("1612802193_1625188512001_20120507050000-sports")) {
vidImg_iv.setImageResource(R.drawable.sports_still);
}