有一个班级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("я", "родился");
}
}
}
从片段中调用
registered_photo = new Photo(getActivity());
registered_photo.Photo_for_registration();
当您调用onActivityResult中的日志失败时。
如果你把所有日志片段都推了出来,那就行了。 而且这个课程没有被召唤。
作为课堂的原因,或者你怎么能绕过另一个?