3

I am having search application, which loads data retreived from the webservice.

While application on create it shows progress dialog once its done with loading data it dismiss the progress dialog.

problem is while loading if i change the orientation of the phone it works fine it try to load activity again, but if i start shaking the cellphone while it is loading data application get crashed, any solution ???

d-man
  • 57,473
  • 85
  • 212
  • 296
  • How can i force activity to do not change its orientation until it gets loaded completely ? – d-man Jan 15 '10 at 13:23

1 Answers1

3

put

android:configChanges="keyboardHidden|orientation"

in you Activity xml tags.

and add these code to your activity.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
}
Cytown
  • 1,539
  • 9
  • 7
  • Why do you need to override `onConfigurationChanged` if you do nothing different in your code? – Mirko N. Jan 15 '10 at 17:05
  • It works though i didn't over the java method only added the xml change. you are genius – d-man Jan 17 '10 at 09:25
  • Just a note that this is an easy way out, and a rotation change isn't the only configuration change one will encounter. You should design your Activities and Asynctasks to be decoupled from each other so that the Asynctask doesn't have a bad Context – SeanPONeil Jan 10 '12 at 02:32