0
을 취소 내 onActivityResult를 내가 사용자 사이에서 작업을 취소하는 경우 시나리오를 처리 할.onActivityResult를 사용자가 이미지</p> <pre><code>startActivityForResult(Intent.createChooser(intent, "Select Picture"), SELECT_PICTURE); </code></pre> <p>을 얻기 위해 내가 활동 호출이 활동
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == SELECT_PICTURE) {
Uri selectedImageUri = data.getData();
String selectedImagePath = getPath(selectedImageUri);
if (selectedImagePath != null) {
//do something
}
else
Log.i("At the","selectedimagenull");
}
else
Log.i("At the","SELECT PICTURENULL");
}
}
그러나 사용자가 아무 작업도 취소하면 정보를 얻지 못합니다. 디버깅을 시도했지만 어디에도 잡히지 않았습니다. 여기서 뭘 잘못하고 있니?
'resultCode == RESULT_CANCELLED'을 (를) 확인할 수 없습니까? – StuStirling
'RESULT_CANCELLED'가 호출중인 그림 편집기에 의해 반환되지 않더라도 'RESULT_OK'이 아닌 것은 모두 취소로 해석 될 수 있습니다 – Kuffs