I have the following method for the button onclick listener
titleBar.setRightBtnOnclickListener(v -> {
savePicture();
PublishActivity.openWithPhotoUri(this, Uri.fromFile(photoPath));
});
i want to be able to pass the filepath of the photo to another activity here i am saving the bitmap
private void savePicture(){
//加滤镜
final Bitmap newBitmap = Bitmap.createBitmap(mImageView.getWidth(), mImageView.getHeight(),
Bitmap.Config.ARGB_8888);
Canvas cv = new Canvas(newBitmap);
RectF dst = new RectF(0, 0, mImageView.getWidth(), mImageView.getHeight());
try {
cv.drawBitmap(mGPUImageView.capture(), null, dst, null);
} catch (InterruptedException e) {
e.printStackTrace();
cv.drawBitmap(currentBitmap, null, dst, null);
}
//加贴纸水印
EffectUtil.applyOnSave(cv, mImageView);
new SavePicToFileTask().execute(newBitmap);
}
Then here am using the async
public class SavePicToFileTask extends AsyncTask<Bitmap,Void,String>{
Bitmap bitmap;
@Override
protected void onPreExecute() {
super.onPreExecute();
showProgressDialog("图片处理中...");
}
@Override
protected String doInBackground(Bitmap... params) {
String fileName = null;
try {
bitmap = params[0];
String picName = TimeUtils.dtFormat(new Date(), "yyyyMMddHHmmss");
fileName = ImageUtils.saveToFile(FileUtils.getInst().getPhotoSavedPath() + "/"+ picName, false, bitmap);
photoPath = new File(fileName);
} catch (Exception e) {
e.printStackTrace();
toast("图片处理错误,请退出相机并重试", Toast.LENGTH_LONG);
}
return fileName;
}
@Override
protected void onPostExecute(String fileName) {
super.onPostExecute(fileName);
dismissProgressDialog();
if (StringUtils.isEmpty(fileName)) {
return;
}
}
}
so am having trouble on how to get the photo path and then using Uri pass it to the next activity thanks guys