/**
   * 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.lunar_layout);

    // get handles to the LunarView from XML, and its LunarThread
    mLunarView = (LunarView) findViewById(R.id.lunar);
    mLunarThread = mLunarView.getThread();

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

    if (savedInstanceState == null) {
      // we were just launched: set up a new game
      mLunarThread.setState(LunarThread.STATE_READY);
      Log.w(this.getClass().getName(), "SIS is null");
    } else {
      // we are being restored: resume a previous game
      mLunarThread.restoreState(savedInstanceState);
      Log.w(this.getClass().getName(), "SIS is nonnull");
    }
  }
 /** Invoked when the Activity loses user focus. */
 @Override
 protected void onPause() {
   super.onPause();
   mLunarView.getThread().pause(); // pause game when Activity pauses
 }