Esempio n. 1
0
  /**
   * Invoked when the Activity is created.
   *
   * @param savedInstanceState a Bundle containing state saved from a previous execution, or null if
   *     this is a new execution
   */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // tell system to use the layout defined in our XML file
    setContentView(R.layout.rsf_layout);

    // get handles to the RsfAppView from XML, and its LunarThread
    mRsfAppView = (RsfAppView) findViewById(R.id.Rsf);
    mRsfAppThread = mRsfAppView.getThread();

    // give the RsfAppView a handle to the TextView used for messages
    mRsfAppView.setTextView((TextView) findViewById(R.id.text));

    if (savedInstanceState == null) {
      // we were just launched: set up a new game
      mRsfAppThread.setState(RsfAppThread.STATE_READY);
      Log.w(this.getClass().getName(), "SIS is null");

    } else {
      // we are being restored: resume a previous game
      mRsfAppThread.restoreState(savedInstanceState);
      Log.w(this.getClass().getName(), "SIS is nonnull");
    }
  }
Esempio n. 2
0
 /** Invoked when the Activity loses user focus. */
 @Override
 protected void onPause() {
   super.onPause();
   mRsfAppView.getThread().pause(); // pause game when Activity pauses
 }