if (extras != null) {
photo = extras.getParcelable("data");
ByteArrayOutputStream stream = new ByteArrayOutputStream();
photo.compress(Bitmap.CompressFormat.PNG, 90, stream);
byte[] byte_arr = stream.toByteArray();
byte[] decodedString = Base64.decode(byte_arr, Base64.DEFAULT);
decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
imageView_pic.setImageBitmap(photo);
}
这样打电话:
dh.insertData("5", "invertorandbettry", t, j, "25.5.2014",
decodedByte);
这是我的代码,我想获取位图,以便我可以将该位图存储在相机和图库的localSqlite
数据库中,但是当我尝试从相机或图库中拍摄照片并在剪裁后{ {1}}在这一行:
java.lang.IllegalArgumentException: bad base-64
想法?
...谢谢
答案 0 :(得分:1)
byte[] decodedString = Base64.decode(image_str, Base64.DEFAULT);
decodedByte = BitmapFactory.decodeByteArray(decodedString, 0,
decodedString.length);
尝试此代码并享受!..............