我有一个获取图像的活动调用
Set<Permission> getAuthorities() {
Authority.findAllById(this.rank)
// instead of: UserAuthority.findAllByUser(this)*.permission
}
在我的onActivityResult上,如果用户取消之间的操作,我想处理该场景。
startActivityForResult(Intent.createChooser(intent, "Select Picture"), SELECT_PICTURE);
但如果用户取消操作无处获取信息。我试过调试,但它没有抓到任何地方。这里有什么问题?
答案 0 :(得分:0)
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");
}
else
Log.i("At the","result not ok"); // User cancelled the activity
}