0

私は画像のデコードされた文字列データを取得しており、そのデータをエンコードして画像ビューに表示したいと考えています。ビットマップでヌル値を取得しています。

それが私がこれまでやってきたことです。

@SuppressLint("NewApi")
public void show(View view){ 
     byte[] imageBytes = null;
    try {
        imageBytes = imagedata.getBytes("UTF-8");
    break;
// here you could place handling of other clicks if necessary...        
    } catch (UnsupportedEncodingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
        InputStream in = new ByteArrayInputStream(imageBytes);
        Bitmap b = BitmapFactory.decodeStream(in);
         image.setImageBitmap(b);

}
4

1 に答える 1

0

画像をデコードするには、次のコードを使用します。

byte[] decodedString = Base64.decode(image_path, Base64.DEFAULT);
Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length, options);
// options.inJustDecodeBounds = false;
promoIV.setImageBitmap(decodedByte);
于 2013-11-12T07:31:10.707 に答える