我正在使用ExifInterface
来旋转图片。图像被放置为ViewPager
的子项。执行旋转后,我检查了保存的图像并更改了方向。但我的viewpager imageview仍然显示以前的方向。
new AsyncTask<Integer,Void,Bitmap>(){
@Override
protected void onPreExecute() {
super.onPreExecute();
mRotateButtonImageView.setEnabled(false);
mCropButtonImageView.setEnabled(false);
mApplyFilterButtonImageView.setEnabled(false);
progressBar.setVisibility(View.VISIBLE);
}
@Override
protected Bitmap doInBackground(Integer... params) {
BitmapUtils.RotateBitmapWithExifInterface(CaptureActivity.captureOriginalImagePathsList.get(params[0]).getFinalImagePath().toString());
BitmapUtils.RotateBitmapWithExifInterface(CaptureActivity.captureOriginalImagePathsList.get(params[0]).getOriginalimagePath().toString());
BitmapUtils.RotateBitmapWithExifInterface(CaptureActivity.captureOriginalImagePathsList.get(params[0]).getmApplyFilterImagePath().toString());
return BitmapUtils.decodeSampledBitmapFile(CaptureActivity.captureOriginalImagePathsList.get(params[0]).getFinalImagePath().toString());
}
@Override
protected void onPostExecute(Bitmap param) {
super.onPostExecute(param);
try {
mRotateButtonImageView.setEnabled(true);
mCropButtonImageView.setEnabled(true);
mApplyFilterButtonImageView.setEnabled(true);
progressBar.setVisibility(View.GONE);
isRotating = false;
mCustomPagerAdapter.notifyDataSetChanged();
mViewPager.setAdapter(mCustomPagerAdapter);
iv.setImageBitmap(param);
//iv.setRotation(0);
}catch (Exception ex){
ex.printStackTrace();
}finally {
if(param != null)
param.recycle();
System.gc();
Runtime.getRuntime().gc();
}
}
}.execute(mViewPager.getCurrentItem());