フォト ギャラリー インテントを呼び出した後、次のメソッドを使用して画像を取得しました。その画像のビットマップを渡して別のアクティビティを開始し、2 番目のアクティビティでその画像を表示したいと考えています。ただし、フォト ギャラリーから写真を選択した後は何も起こりません。
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();
}
}
}
}
}
誰が何が問題なのか教えてもらえますか?
注意: 1.マニフェストにアクティビティを追加しました
2.これに関するlogcatエラーまたは例外はありません
3. デバッグを完了しました。startActivity 行までは正しく進みますが、その後は何も起こりません。