My Android App is crashing when I'm rotating the screen with ProgressBar
and an AsyncTask
running. Can somebody help me to resolve this issue.
Asked
Active
Viewed 222 times
-2
-
2Post the logcat error and the code where progress bar is started in async task. – Aduait Pokhriyal Mar 12 '14 at 10:39
-
If your app crashed then you have to post your logcat with particular exception. – Piyush Mar 12 '14 at 10:42
-
Show your AsyncTask class... – Piyush Mar 12 '14 at 10:45
-
Got answer need to "android:configChanges="orientation|screenSize" line to activity in manifest file..Thanks for your help!! Got this answer from "Application Crashes on orientation change while showing Progress Bar in AsyncTask" this stack overflow question. – Paddy Mar 12 '14 at 10:48
-
Put some code for more information so we help you out. – Rahul Kumar Mar 12 '14 at 10:48
2 Answers
0
When you rotate screen than your AsyncTask
start again as per this question How to handle an AsyncTask during Screen Rotation? and onResume
also gets called. so may be your ProgressBar
refrenceing null
.
so use this to handle
android:configChanges="keyboardHidden|orientation"
in your Activity
tag in Manifest file.

Community
- 1
- 1

Sanket Kachhela
- 10,861
- 8
- 50
- 75
-
Check this .http://stackoverflow.com/questions/22348006/seekbar-progress-changed-but-glsurface-view-not-affected. – Piyush Mar 12 '14 at 10:45
0
try using this block of code in the asyncTask, it worked pretty much for me.
runOnUiThread(new Runnable() {
@Override
public void run() {
//stuff that updates ui
}
});

Fadi Hasrouni
- 16
- 1