Android: Device rotation

Why do values in input field lose after rotating device?

  • You need to set an ID for each field, so that when the device is rotated, fields will be filled back correctly
  • Why does the app crash when rotating the device

  • If an AsyncTask is run in background, it will run independently with Activity. When rotating the device, Activity is destroyed but AsyncTask does not.So, when AsyncTask finishes, it will try to update former Activity which no longer exist. This makes the app crash
  • Be the first to comment

    Leave a Reply

    Your email address will not be published.


    *