80,349
社区成员
发帖
与我相关
我的任务
分享
// First handle the no crop case -- just return the value. If the
// caller specifies a "save uri" then write the data to it's
// stream. Otherwise, pass back a scaled down version of the bitmap
// directly in the extras.
if (mSaveUri != null) { //存在mSaveUri,即指定了目标uri
OutputStream outputStream = null;
try {
outputStream = mContentResolver.openOutputStream(mSaveUri);
outputStream.write(data);
outputStream.close();
setResult(RESULT_OK); //直接返回RESULT_OK,并没有指定intent
finish();
} catch (IOException ex) {
// ignore exception
} finally {
Util.closeSilently(outputStream);
}
} else {
Bitmap bitmap = createCaptureBitmap(data);
// 返回RESULT_OK,并包含一个Intent对象,其中Extra中科key为data,value为一个bitmap
setResult(RESULT_OK, new Intent("inline-data").putExtra("data", bitmap));
finish();
}