简体   繁体   中英

Android app crash when progress dialog is on progress and app's orientation changed. why?

I have an application in which a progress dialog is shown. The progress dialog is working properly on any one orientation. But when I change the orientation during the progress dialog is on progress mode, then the app crashes.

So, now how can i fix this problem?


Update

Hello, Thanks for your answer. Here I have extracted the progress dialog code from the whole project and there is no problem. You have said to see the Log cat file. But I do not understand the Logcat file. Actually what type of error message will be on the Logcat file if the Activity.onCreate() function will create any problem?

If you have any senario please help me.

Best Regards, gsmaker

Most chances, this is not the ProgressDialog fault. Take into an account that Activity.onCreate() is called on every orientation change. In any case, look at LogCat output, you will get more information about the FC.

in your AndroidManifest.xml, add in the used activity this:

android:screenOrientation="nosensor" android:configChanges="keyboardHidden|orientation"

Post the logcat, go to the terminal.. Type the directory /home/xyz/andorid -sdk-xxx/tools

once in this directory. type ./abd logcat

if you are in windows, direct via command prompt to tools directory. Type adb logcat on command line.

do this after you have started the emulator. Once the emulator is running you will see the logcat printing data every time something happens on ur emulator/device (whatever is running).

Now change the orientation and you will see data being printed onto the logcat.. When the app crashes, normally a message will be printed... In my advice you copy all that and paste it here, or better, just paste your code here. Only then can we help...

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