I want to save image in sqlite. In this method I have got image path into string. My Question is How to convert it into byte[] format.
if (resultCode == RESULT_OK) {
// we need to update the gallery by starting MediaSanner service.
mScanner = new MediaScannerConnection(ImagePreviewActivity.this,new MediaScannerConnection.MediaScannerConnectionClient() {
public void onMediaScannerConnected() {
mScanner.scanFile(imageUri.getPath(), null );
}
public void onScanCompleted(String path, Uri uri) {
mScanner.disconnect();
if (path.equals(imageUri.getPath())) {
photoPath=imageUri.getPath();
ImagePreviewActivity.this.runOnUiThread(new Runnable() {
public void run() {
capture_photo = (ImageView) findViewById(R.id.caturePhoto);
Bitmap myBitmap = BitmapFactory.decodeFile(photoPath);
capture_photo.setImageBitmap(myBitmap);
}
});
mScanner.disconnect();
}
}
});
mScanner.connect();