Android app crashes on screen orientation change

1.5k views Asked by At

I'm developing an application which will support multiple screens. I have created three layouts (large, small, medium). I'm testing it. I have two screens sign in and sign up.

In sign in it is working fine. But when I click on sign up button then I go to sign up page and if I'm in portrait mode and changes the mode the app gets crashed and there is no something like crash report in the logcat as well.

4

There are 4 answers

0
Nanne On BEST ANSWER

If you have not added any code like android:configChanges="orientation|keyboardHidden" to your manifest, your current activity (sign up?) will restart if you change the mode. It could be that you cannot restart the activity at that point because not all the info will be available for the activity.

(btw: your question is not completely clear, but I gather that if you change mode (portrait/landscape) in a certain activity your application crashes)

0
Vladimir Ivanov On

By default, android restarts your activity in case of configuration changed. You should correctly treat this restart(by saving and restoring saved instance) or as a not recommended way override onConfigurationChanged() method.

0
Alexey Kruchenok On

Try to run you application in debug mode, in case of crash you will see exception that cause problem.

1
Ayudh On

why u used different screen for portrait n landscape , many times we can't used different screen . we written code in that way , its common for both the screens

ex. in layout parameters u used "fill_parent" for width , it is effective in both cases

In your case , you make signin and signup form,i m also make a signin and signup form and i don't feel to make different layouts or screen.

I suggest that make common screen for both Mode.