My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 13: Switching orientation resets the app
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  germanvi...@gmail.com
Closed:  Jun 2009


 
Project Member Reported by germanvi...@gmail.com, Jun 26, 2009
onCreate() is called when orientation is switched.
In order to fix check this page:
http://stackoverflow.com/questions/584779/android-switching-between-landscape-and-portrait-mode-makes-intent-lose-values

Jun 26, 2009
Project Member #1 germanvi...@gmail.com
Maybe we should save state via preferences during an orientation switch:

public class CalendarActivity extends Activity {
     ...

     static final int DAY_VIEW_MODE = 0;
     static final int WEEK_VIEW_MODE = 1;

     private SharedPreferences mPrefs;
     private int mCurViewMode;

     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);

         SharedPreferences mPrefs = getSharedPreferences();
         mCurViewMode = mPrefs.getInt("view_mode" DAY_VIEW_MODE);
     }

     protected void onPause() {
         super.onPause();
 
         SharedPreferences.Editor ed = mPrefs.edit();
         ed.putInt("view_mode", mCurViewMode);
         ed.commit();
     }
 }

Jun 27, 2009
Project Member #2 germanvi...@gmail.com
(No comment was entered for this change.)
Status: Fixed

Powered by Google Project Hosting