예제 #1
1
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case android.R.id.home:
       // This ID represents the Home or Up button. In the case of this
       // activity, the Up button is shown. Use NavUtils to allow users
       // to navigate up one level in the application structure. For
       // more details, see the Navigation pattern on Android Design:
       //
       // http://developer.android.com/design/patterns/navigation.html#up-vs-back
       //
       // NavUtils.navigateUpFromSameTask(this);
       super.onBackPressed();
       return true;
     case R.id.network_info:
       NetworkDialogFragment ndf = NetworkDialogFragment.newInstance();
       ndf.show(getFragmentManager(), "networkInfo");
       return true;
     case R.id.help:
       HelpDialogFragment hdf =
           HelpDialogFragment.newInstance(
               getString(R.string.help_title_network_config),
               getString(R.string.help_text_network_config));
       hdf.show(getFragmentManager(), "help");
       return true;
   }
   return super.onOptionsItemSelected(item);
 }
예제 #2
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case android.R.id.home:
       Intent i = new Intent(this, ElectorateActivity.class);
       i.putExtra("poll", (Serializable) poll);
       NavUtils.navigateUpTo(this, i);
       return true;
     case R.id.help:
       HelpDialogFragment hdf =
           HelpDialogFragment.newInstance(
               getString(R.string.help_title_review), getString(R.string.help_text_review_admin));
       hdf.show(getFragmentManager(), "help");
       return true;
     case R.id.action_start_voteperiod:
       startVotePeriod();
   }
   return super.onOptionsItemSelected(item);
 }