I’m trying to pass on a file location and an id via the intent of the camera after taking a picture.
That happens in this code:
btaddphoto.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Integer vraagnr = Integer.parseInt(lblQuestionNr.getText().toString());
String _path = Environment.getExternalStorageDirectory().toString() + File.separator + "photo_" + vraagnr.toString() + ".png";
File file = new File(_path);
Uri outputFileUri = Uri.fromFile(file);
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
intent.putExtra("view", newview.Id);
((Activity) ctx).startActivityForResult(intent, newview.Id);
}
});
In this code the intent exists, aka is not null.
In this code data is null:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
}
Why is data null?
Is it not the same Intent as the Intent in the OnClick event?
rg,
Eric
No, this is not the same
Intentas you sent in the onClick event. ThisIntentis returned as response from camera activity (i.e. android.media.action.IMAGE_CAPTURE). Here (in onActivityResult) you need to check if the data object isnullthen there’s no data returned from the camera activity.