I have a problem in getting photo from camera
Bundle extras = new Bundle()
extras.putString("photo",photo.getPath());
extras.putParcelable(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo));
cameraIntent.putExtras(extras);
startActivityForResult(cameraIntent, Constants.CAMERA_REQUEST);
and there I am trying to get data:
case Constants.CAMERA_REQUEST: {
if (resultCode != RESULT_OK)
return;
if (data != null) {
Bundle extras = data.getExtras(); //data always null
SetPhotoToView(extras.getString("photo"));
}
break;
try using this to get intent values
getIntent().getStringExtra("photo") ;
or
Bundle b = new Bundle();
b = getIntent().getExtras();
String name = b.getString("name");
if (data != null) { // Before this check
Before check data is Null or Not get Data from Intent
String data = getIntent().getExtras().getString("photo");
and then check for data Null or Not
if(data != null){
//DEAL WITH YOUR DATA
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.