igreenwood / SimpleCropView

A simple image cropping library for Android.
MIT License
2.48k stars 466 forks source link

After screen rotation Crop image view doesn't work. #75

Open amir5121 opened 8 years ago

amir5121 commented 8 years ago

Crop image view doesn't respond to touch events after screen rotation. I got it working by restarting the activity but then SaveCallBack onError gets called instead of onSuccess.

igreenwood commented 8 years ago

Hi,

Can you describe more detail? The bug seems to not occured in my sample.(https://github.com/IsseiAoki/SimpleCropView/tree/master/simplecropview-sample)

amir5121 commented 8 years ago

I took a look at the sample and apparently the instance of the fragment is saved during screen rotation. However in my case the cropImageView is owned by an activity which it's layout changes under screen rotations. I inspected my code further and realized that after screen rotation LoadCallback isn't being called (although i was calling startLoad method) causing the cropView to become unresponsive. So i stopped calling the mCropView.startLoad when savedInatanceState was not null and the issue was solved. I don't know if it's a bug.

igreenwood commented 8 years ago

Hi,

I understood what you said. It's not a bug. On screen rotation changed, Activity is automatically recreated. So, you cannot handle the asynchronous process that continues beyond screen rotation in Activity.

See this link below. http://www.androiddesignpatterns.com/2013/04/retaining-objects-across-config-changes.html