コード例 #1
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   if (!mNavigationDrawerFragment.isDrawerOpen()) {
     // Only show items in the action bar relevant to this screen
     // if the drawer is not showing. Otherwise, let the drawer
     // decide what to show in the action bar.
     getMenuInflater().inflate(R.menu.main, menu);
     restoreActionBar();
     return true;
   }
   return super.onCreateOptionsMenu(menu);
 }
コード例 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Parse.initialize(
        this,
        "bk8rNWKoCfeqR6yu9X0ailkXOIBVkF1grOh2rubV",
        "Rw3rQrNlqfW4yxyhkflgZT3dZcEfSNEkzURRhOIu");
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    mNavigationDrawerFragment =
        (NavigationDrawerFragment)
            getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
    mTitle = getTitle();

    // Set up the drawer.
    mNavigationDrawerFragment.setUp(
        R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout));
    if (!isNetworkAvailable()) {
      Toast.makeText(this, "¡No tienes conexción a Internet!", Toast.LENGTH_SHORT).show();
      finish();
    }
  }