@Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (Media3D.DEBUG) {
      Log.v(TAG, "onCreate()");
    }
    setContentView(R.layout.media3d);

    AnimationLoader.setCacheDir(getCacheDir());

    SimpleVideoView backgroundVideo = (SimpleVideoView) findViewById(R.id.bg_video);

    mGestureDetector = new GestureDetector(this, new MyGestureListener());

    mStage = new Stage();
    mStage.setBackgroundColor(new com.mediatek.ngin3d.Color(0x00, 0x00, 0x00, 0x00));
    mStage.addTextureAtlas(getResources(), R.raw.media3d_atlas, R.raw.media3d);
    mStage.setMaxFPS(60);

    // Media3D was designed with a system that used left-handed coordinates.
    // The graphics engine now uses a conventional right-handed system so we
    // use a 'special' projection to compensate for this.
    mStage.setProjection(Stage.UI_PERSPECTIVE_LHC, 2.0f, 3000.0f, -1111.0f);

    mMedia3DView = new Media3DView(this, mStage, backgroundVideo);

    mPortalPage = new PortalPage(mStage);
    loadPage(mPortalPage, savedInstanceState);
    mPortalPage.setPageQueryCallback(this);

    mWeatherPage = new WeatherPage(mStage);
    mPhotoPage = new PhotoPage(mStage);
    mVideoPage = new VideoPage(mStage);

    Setting setting = Setting.realize(this, R.xml.configuration);
    WeatherPage.loadConfiguration(setting);
    PhotoPage.loadConfiguration(setting);
    VideoPage.loadConfiguration(setting);

    loadPageAsync(savedInstanceState, mWeatherPage, mPhotoPage, mVideoPage);

    backgroundVideo.setZOrderMediaOverlay(false);

    mMedia3DView.setZOrderMediaOverlay(true);
    FrameLayout frame = (FrameLayout) findViewById(R.id.stage_root);
    frame.addView(mMedia3DView);

    mOrientationListener = new OrientationListener(this, SensorManager.SENSOR_DELAY_NORMAL);

    if (mOrientationListener.canDetectOrientation()) {
      mOrientationListener.enable();
    }

    Intent intent = getIntent();
    if (intent.getAction() != null) {
      if (intent.getAction().equalsIgnoreCase("android.intent.action.ROTATED_MAIN")) {
        mIsAutoRotateLaunched = true;
      }
    }

    if (mCurrentPage == null) {
      mCurrentPage = mPortalPage;
    }
    mMedia3DView.enterPage(mCurrentPage);
  }