-2

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.

super-qua
  • 3,148
  • 1
  • 23
  • 30
Paddy
  • 13
  • 3

2 Answers2

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
          }
        });