1

I'm trying to set a progress bar in the actionbar

and in a fragment, there is a asynctask to load json data to show in a webview

when the onPostExecute is called, I use this to disable the progress bar

getActivity().setProgressBarIndeterminateVisibility(false);

but if the asynctank haven't finish, and I leave the fragment

there would have a nullpointer exception.

Is there any solution?

user3810824
  • 63
  • 1
  • 4
  • i suggest adding a [callback to your asynctask](http://stackoverflow.com/questions/9963691/android-asynctask-sending-callbacks-to-ui).. and add in your `onPostExecute` if(callback!=null){ callback.setProgressBarVisibility(false);} – Spurdow Aug 14 '14 at 05:52

0 Answers0