Beispiel #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    SurfaceView surfaceView = (SurfaceView) findViewById(R.id.surfaceView);
    surfaceView.getHolder().addCallback(this);
    surfaceView.setOnTouchListener(this);

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout);
    if (mDrawerLayout != null) { // xlarge-land has no drawer layout (drawer is always open)
      mDrawerToggle =
          new ActionBarDrawerToggle(
              this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close);
      mDrawerLayout.addDrawerListener(mDrawerToggle);
      getActionBar().setDisplayHomeAsUpEnabled(true);
      getActionBar().setHomeButtonEnabled(true);
    }

    mDrawerList = (ListView) findViewById(R.id.leftDrawer);
    mStateAdapter = new StateAdapter(this);
    mDrawerList.setAdapter(mStateAdapter);

    mApplication = (ViewerApplication) getApplication();
    mApplication.setViewerActivity(this);
  }
Beispiel #2
0
 @Override
 protected void onDestroy() {
   mApplication.setViewerActivity(null);
   super.onDestroy();
 }