我正在使用Photoeditor SDK,在摄像机活动中捕获图像后,它应该转到名为“ServiceList”的活动,但这不会返回到该活动。我该如何解决?
SDK代码 -
public class CameraPhotoEditorSdk extends Activity implements PermissionRequest.Response {
private static final String FOLDER = "Roadlike";
public static int CAMERA_PREVIEW_RESULT = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
protected void onResume() {
super.onResume();
SettingsList settingsList = new SettingsList();
settingsList
.getSettingsModel(CameraSettings.class)
.setExportDir(Directory.DCIM, FOLDER)
.setExportPrefix("camera_")
.getSettingsModel(EditorSaveSettings.class)
.setExportDir(Directory.DCIM, FOLDER)
.setExportPrefix("result_")
.setJpegQuality(80, false)
.setSavePolicy(EditorSaveSettings.SavePolicy.KEEP_SOURCE_AND_CREATE_ALWAYS_OUTPUT);
new CameraPreviewBuilder(this)
.setSettingsList(settingsList)
.startActivityForResult(this, CAMERA_PREVIEW_RESULT);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, android.content.Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK && requestCode == CAMERA_PREVIEW_RESULT) {
String resultPath = data.getStringExtra(ImgLyIntent.RESULT_IMAGE_PATH);
String sourcePath = data.getStringExtra(ImgLyIntent.SOURCE_IMAGE_PATH);
if (resultPath != null) {
// Add result file to Gallery
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(new File(resultPath))));
}
if (sourcePath != null) {
// Add sourceType file to Gallery
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(new File(sourcePath))));
}
Toast.makeText(PESDK.getAppContext(), "Image saved on: " + resultPath, Toast.LENGTH_LONG).show();
} else if (resultCode == RESULT_CANCELED && requestCode == CAMERA_PREVIEW_RESULT && data != null) {
String sourcePath = data.getStringExtra(ImgLyIntent.SOURCE_IMAGE_PATH);
Toast.makeText(PESDK.getAppContext(), "Editor canceled, sourceType image is:\n" + sourcePath, Toast.LENGTH_LONG).show();
} else {
finish();
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
PermissionRequest.onRequestPermissionsResult(requestCode, permissions, grantResults);
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
@Override
public void permissionGranted() {
}
@Override
public void permissionDenied() {
finish();
System.exit(0);
}
}
我尝试使用
导航它startActivityForResult(ServiceList,1);
但是这并没有给出我正在寻找的结果。
任何帮助都会有所帮助。