简体   繁体   中英

Saving Android FaceDetector.Face[] on rotation

I am trying to save the FaceDetector.Face array so that on a screen rotation, the facial detection does not have to be performed again. The app seems to take longer than a normal rotation. However, I can't store the faces array in onSavedInstanceState since it isn't serializable. I tried extending FaceDetector.Face with implementing serializable, but it doesn't have a default constructor. What should I do to save an Object array like this one on rotation, that I didn't implement?

I would suggest creating a static Fragment without UI on that activity. Once you do that, you can use it to store this data. Keep in mind that FaceDetector.Face, is just an object that holds locations on bitmap and not the bitmap itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM