嗨,大家好,我想問你一件事,我有一個聊天傳輸字符串,我甚至可以附加JPEG圖像,然後發送它們將其轉換爲字符串,然後在BITMAP中解碼只是當我解碼它崩潰的應用程序。我想知道它是否是正確的解碼代碼。android解碼字符串基地64位圖
NOME = (TextView) row.findViewById(R.id.comment);
NOME.setText(coment.comment);
String a = NOME.getText().toString();
if(a.length() > 1024)
{
byte[] image = Base64.decode(a, 0);
int lung = a.length();
Bitmap bitmap = BitmapFactory.decodeByteArray(image, 0, lung);
Image = (ImageView) row.findViewById(R.id.image);
Image.setImageBitmap(bitmap);
}
請在這裏添加logcat的,這樣一看就明白你崩潰的原因 – Arshu