(R.drawable.logo)object
をstring
に変換して、listview
に表示したいとします。私はそれのために次のコードを使用しますが、それはあなたがあなたのイメージは、Base64文字列に変換する必要はありませんSimpleAdapter
を使用してListView
で画像を表示するにはAndroidでImage ListViewを取得するにはどうすればよいですか?
Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(), R.drawable.logo);
ByteArrayOutputStream ByteStream = new ByteArrayOutputStream();
bitmapOrg.compress(Bitmap.CompressFormat.PNG,100, ByteStream);
byte [] b = ByteStream.toByteArray();
String temp = Base64.encodeToString(b, Base64.DEFAULT);
ListAdapter adapter = new SimpleAdapter(
Welcome.this,
contactList,
R.layout.about,
new String[] { TAG_NAME, TAG_SURNAME, temp },
new int[] { R.id.name, R.id.surname, R.id.imageView}
);
list.setAdapter(adapter);
ERROR: Unable to decode stream: java.io.FileNotFoundException: : open failed: ENOENT (No such file or directory)
あなたは画像の文字列値を取得していますか? –
ビットマップをBase64文字列に変換したいのですか? –
@BoldijarPaulはい私はそれを試しても動作していない – gaddarHamolka