0

When orientation of phone changes during loading of images from sdcard the application crashes due to

java.lang.RuntimeException: An error occured while executing doInBackground()

I am using the code from http://mihaifonoage.blogspot.com/2009/11/displaying-images-from-sd-card-in.html

can any one Please help me

jmj
  • 237,923
  • 42
  • 401
  • 438

2 Answers2

0

When orientation of the phone changes, your activity is destroyed and created again. This can cause problems in many occasions. Do avoid this use:

android:configChanges="orientation|keyboardHidden"

in the activity declaration in AndroidManifest.xml.

kgiannakakis
  • 103,016
  • 27
  • 158
  • 194
  • Hi, Thanks for the reply. It worked fine. But i am using two layouts for two orientations. Portrait has 3 images and landscape has 5 images. But the image not adjusting properly as i arranged. Can you Please help me – user649400 Mar 12 '11 at 04:02