カメラでキャプチャした画像をデータベースに保存し、データベースから取得しています。もう一度キャプチャして画像ビューに表示しているので、現在の画像が Android OS バージョン 4.1 に表示されます。
同様に、OS バージョン 4.2 の samsung コアでは機能しません。
これはOSの問題か何か他のものなので、解決策を提案してください
ボタンクリックで
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 0);
イメージビューに画像を設定するには、
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 0 && resultCode == RESULT_OK) {
if (data != null) {
photo = (Bitmap) data.getExtras().get("data");
Log.d("camera ---- > ", "" + data.getExtras().get("data"));
img.setImageBitmap(photo);
}
}
}
sqlite データベースに保存するには、
ByteArrayOutputStream baos = new ByteArrayOutputStream();
photo.compress(Bitmap.CompressFormat.JPEG, 100, baos);
byte[] byteArray = baos.toByteArray();
parent.setImage(byteArray);
データベースから取得して表示するには..
ByteArrayInputStream imageStream = new ByteArrayInputStream(outImage);
Bitmap theImage = BitmapFactory.decodeStream(imageStream);
img.setImageBitmap(theImage);