我有一个片段,它像这样从画廊意图中调用 Select Image
Intent intent=new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Complete Action Using"),1);
我已成功执行上述启动电话库的方法,我可以从那里选择图像,但应用程序应该返回调用片段但它不是,即使我可以在 LogCat 中看到 onActivityonResult 调用
我还有一个从地图返回到调用片段的位置,但是在选择图像时我没有回到调用活动,而是显示父活动第一个片段
这是我的onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode==1 && resultCode==getActivity().RESULT_OK){
Log.d(TAG,"Request Code is 1 Running: "+requestCode+" "+resultCode);
Uri imageNameURL=data.getData();
Log.d(TAG,imageNameURL.toString());
ImagePath=getPath(imageNameURL);
Log.d(TAG,"onActivityResult "+ImagePath);
bitmap= BitmapFactory.decodeFile(ImagePath);
}
else if (requestCode==2 && resultCode==getActivity().RESULT_OK){
Log.d(TAG,"Request Code 2 Running");
LatLngBounds LL= PlacePicker.getLatLngBounds(data);
double lat=LL.northeast.latitude;
double longi=LL.northeast.longitude;
double lat2=LL.southwest.latitude;
double longi2=LL.southwest.longitude;
}
}