コード例 #1
0
 public void onBackPressed() {
   if (currentLayout == R.layout.snet_contact) {
     setLayoutMain();
     currentLayout = R.layout.snet_main;
   } else {
     super.onBackPressed();
   }
 }
コード例 #2
0
  /**
   * Called whenever Android infrastructure feels like it; for example, if the user hits the Home
   * button.
   */
  @Override
  protected void onStop() {
    super.onStop();
    Log.d(TAG, "onStop");

    SharedPreferences settings = getSharedPreferences(PREFS_NAME, 3);
    SharedPreferences.Editor editor = settings.edit();
    editor.putInt("currentLayout", currentLayout);
    editor.commit();
  }
コード例 #3
0
 /**
  * Called after we've been unloaded from memory and are restarting. E.g., 1st launch after
  * power-up; relaunch after going Home.
  */
 protected void onStart() {
   super.onStart();
   Log.d(TAG, "onStart");
   SharedPreferences settings = getSharedPreferences(PREFS_NAME, 3);
   if (settings.getInt("currentLayout", currentLayout) == R.layout.snet_main) {
     setLayoutMain();
     currentLayout = R.layout.snet_main;
   } else {
     Log.d(TAG, "Layout is contact");
     setLayoutContact();
     currentLayout = R.layout.snet_contact;
   }
   // save my context so that this app can retrieve it later
   ContextManager.setActivityContext(this);
 }
コード例 #4
0
 /** Called when the activity is first created. */
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   Log.d(TAG, "onCreate");
 }