I am a new app developer and I have created a quiz game in my app. The game is to be played in portrait mode. After the game is over, the score is calculated and is shown in the score page. When I click ok, a pop up window appears and asks for the name. I have placed an option to share the result in Facebook and Twitter.
Now when I enter the name and click ok, a page with score name and share button appears. If I click share, it moves into Facebook or the other, but if I change over to landscape mode, my app crashes.
This is the same if the game is finished in landscape and switched over to portrait. How to overcome this issue? Please help me.
It would help if you posted some info about the crash, such as what shows up in LogCat. However, the usual suspect here is that you aren’t handling the activity lifecycle correctly. When the orientation changes, your app’s activities are shut down and restarted. You need to handle this correctly in your code. For details, read these articles and guide docs: