使用方法如下加个标记:
new Thread(new Runnable() {
@Override
public void run() {
Bitmap bitmap = mClipImageLayout.clip();
File file = getCacheDir(IncCropLicenseIconActivity.this, System.currentTimeMillis() + ".png");
ImageTools.savePhotoToSDCard(bitmap, file);
Luban.with(IncCropLicenseIconActivity.this).load(file).setCompressListener(new OnCompressListener() {
@Override
public void onStart() {
}
@Override
public void onSuccess(File file) {
loadingDialog.dismiss();
Intent intent = new Intent();
intent.setData(Uri.fromFile(file));
setResult(RESULT_OK, intent);
finish();
}
@Override
public void onError(Throwable e) {
loadingDialog.dismiss();
}
}).launch();
}
}).start();