-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hex crashes when device is rotated #9
Comments
It looks like an activity fragment is going stale during the activity lifecycle. https://developer.android.com/guide/topics/resources/runtime-changes.html When the orientation changes, the StoryActivity is destroyed and recreated but some part of the ArticleFragment is going bad during one of the state changes. The article I linked suggest two ways of dealing with this. Both options would prevent a page refresh which I think is a win. The easiest thing to do is say you will manually handle the orientation change in your manifest. All you have to do is add this attribute value pair to the activity tag for the StoryActivity. android:configChanges="orientation|screenSize" The article says this is not recommended because it makes it "more difficult to use alternative resources". I'm not sure alternative resources are needed. The alternative is to let the app restart the activity like normal but store the data you need in a stateful object. I'm not sure which members you would need to store. Maybe just the mPagerAdapter containing the article fragment. Let me know what you think. I can send you a pull request if needed. |
Hey @RyanRiddle - thanks for raising this and providing so much detail :) Apologies for the bug! I raised a fix for this in #10 and deployed in v0.1.5. The new version has been pushed to the Play Store and should live in the next few hours. To fix this for the front page I bundle up and restore the state in
Pull requests are always welcome on this project! There was nothing written down to document this so I've added some contribution guidelines to the project. |
Thanks for getting this fixed so quickly! I downloaded the latest version I could not reproduce issue #11 but if I run into it later I might take a Good job on this app! Works great and the code is a pleasure to work with. Ryan On Sat, Aug 20, 2016 at 9:59 AM Sean Powell [email protected]
|
If I rotate my Nexus 5 while I am viewing an article or the comments, Hex crashes. "Unfortunately, Hex has stopped."
Rotating the device is not a problem if I am viewing the first page.
Steps to reproduce:
Open Hex.
Choose a link.
When the article has loaded, rotate the device.
Hex crashes.
It also crashes if you are viewing the comments.
It also crashes if you are viewing the front page in landscape orientation, choose an article, and the rotate the device to portrait orientation.
My device is a Nexus 5.
The text was updated successfully, but these errors were encountered: