I have used following method to get image after calling photo gallery intent. I want to start another activity by passing the bitmap of that image and show that image in the second activity. But, nothing will happen after a photo is picked from photo gallery.
protected void onActivityResult(int requestCode, int resultCode, Intent
data) {
final String path;
if (requestCode == GALLERY_REQUEST) {
if (resultCode == Activity.RESULT_OK) {
Uri imageFileUri = data.getData();
if (imageFileUri != null) {
try {
path = getPath(imageFileUri);
BitmapFactory.Options load_option = new BitmapFactory.Options();
load_option.inPurgeable = true;
load_option.inDensity = 0;
load_option.inTargetDensity = 0;
load_option.inDensity = 0;
load_option.inScaled = false;
bmp_main = BitmapFactory.decodeFile(path, load_option);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp_main.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
Intent intentPhoto = new Intent(MainActivity.this, SecondActivity.class);
intentPhoto.putExtra("image",byteArray);
startActivity(intentPhoto);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
Can anybody tell what's the problem?
N.B.: 1.I have added the activity in the manifest
2. There is no logcat error or exception regarding this
3. I have done debugging, it goes upto startActivity line correctly, but after that nothing happen