There is a class, Photo
:
public class Photo {
Uri mUri;
Activity ac;
public static final int PHOTO_INTENT_REQUEST_CODE = 100;
Photo(Activity ac) {
this.ac = ac;
}
boolean Photo_for_registration(){
mUri = generateFileUri();
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, mUri);
ac.startActivityForResult(intent, PHOTO_INTENT_REQUEST_CODE);
return true;
}
private Uri generateFileUri() {
File newFile = new File(path.getPath() + File.separator + "profile" + ".jpg");
return Uri.fromFile(newFile);
}
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
// Get bundle
Bundle extras = intent.getExtras();
if (requestCode == PHOTO_INTENT_REQUEST_CODE) {
Log.e("act", requestCode + " " + resultCode + " " + intent.toString());
Log.d("я", "родился");
}
}
}
That is called from a fragment,
registered_photo = new Photo(getActivity());
registered_photo.Photo_for_registration();
when you call logs in onActivityResult fail.
If you shove all in a fragment of the logs, it works. And the class is not called.
As the cause of the class, or how can you get around that on another?