Java Code Examples for android.support.v4.app.NavUtils

The following are top voted examples for showing how to use android.support.v4.app.NavUtils. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: GitHub   File: FeedActivity.java   View source code 7 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        // Respond to the action bar's Up/Home button
        case android.R.id.home:
            Intent upIntent = NavUtils.getParentActivityIntent(this);
            upIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            if (NavUtils.shouldUpRecreateTask(this, upIntent)) {
                // This activity is NOT part of this app's task, so create a new task
                // when navigating up, with a synthesized back stack.
                TaskStackBuilder.create(this)
                        // Add all of this activity's parents to the back stack
                        .addNextIntentWithParentStack(upIntent)
                        // Navigate up to the closest parent
                        .startActivities();
            } else {
                // This activity is part of this app's task, so simply
                // navigate up to the logical parent activity.
                NavUtils.navigateUpTo(this, upIntent);
            }
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 2
Project: android-mvp-interactor-architecture   File: FeedActivity.java   View source code 7 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        // Respond to the action bar's Up/Home button
        case android.R.id.home:
            Intent upIntent = NavUtils.getParentActivityIntent(this);
            upIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            if (NavUtils.shouldUpRecreateTask(this, upIntent)) {
                // This activity is NOT part of this app's task, so create a new task
                // when navigating up, with a synthesized back stack.
                TaskStackBuilder.create(this)
                        // Add all of this activity's parents to the back stack
                        .addNextIntentWithParentStack(upIntent)
                        // Navigate up to the closest parent
                        .startActivities();
            } else {
                // This activity is part of this app's task, so simply
                // navigate up to the logical parent activity.
                NavUtils.navigateUpTo(this, upIntent);
            }
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 3
Project: Make-A-Pede-Android-App   File: ControllerActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch (item.getItemId()) {
		case R.id.action_joystick:
			setCurrentFragment(FRAGMENT_JOYSTICK);
			break;

		case R.id.action_arrows:
			setCurrentFragment(FRAGMENT_ARROWS);
			break;

		case android.R.id.home:
			NavUtils.navigateUpFromSameTask(this);
			break;
	}

	return true;
}
 
Example 4
Project: Wings2K16   File: Developer.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        return true;
    }
    //noinspection SimplifiableIfStatement
    if (id == android.R.id.home) {

        NavUtils.navigateUpFromSameTask(this);
    }

    return super.onOptionsItemSelected(item);
}
 
Example 5
Project: Wings2K16   File: EventViewActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        return true;
    }
    //noinspection SimplifiableIfStatement
    if (id == android.R.id.home) {

        NavUtils.navigateUpFromSameTask(this);
        overridePendingTransition(R.drawable.from_middle, R.drawable.to_middle);

    }
    return super.onOptionsItemSelected(item);
}
 
Example 6
Project: SampleAppArch   File: SimpleDetailActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
  int id = item.getItemId();
  if (id == 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.navigateUpTo(this, new Intent(this, SimpleListActivity.class));
    return true;
  }
  return super.onOptionsItemSelected(item);
}
 
Example 7
Project: eggs-android   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        // Respond to the action bar's Up/Home button
        case android.R.id.home:
            Intent upIntent = NavUtils.getParentActivityIntent(this);
            upIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            if (NavUtils.shouldUpRecreateTask(this, upIntent)) {
                // This activity is NOT part of this app's task, so create a new task
                // when navigating up, with a synthesized back stack.
                TaskStackBuilder.create(this)
                        // Add all of this activity's parents to the back stack
                        .addNextIntentWithParentStack(upIntent)
                        // Navigate up to the closest parent
                        .startActivities();
            } else {
                // This activity is part of this app's task, so simply
                // navigate up to the logical parent activity.
                NavUtils.navigateUpTo(this, upIntent);
            }
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 8
Project: mobile-store   File: RepoDetailsActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            NavUtils.navigateUpFromSameTask(this);
            return true;
        case R.id.menu_delete:
            promptForDelete();
            return true;
        case R.id.menu_enable_nfc:
            Intent intent = new Intent(this, NfcNotEnabledActivity.class);
            startActivity(intent);
            return true;
    }

    return super.onOptionsItemSelected(item);
}
 
Example 9
Project: Treebolic   File: ProvidersActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(@NonNull final MenuItem item)
{
	switch (item.getItemId())
	{
		case android.R.id.home:
			NavUtils.navigateUpFromSameTask(this);
			return true;

		case R.id.action_rescan:
			final BaseAdapter adapter = Providers.makeAdapter(this, R.layout.item_providers, from, to, true);
			final ListView listView = findViewById(R.id.providers);
			listView.setAdapter(adapter);
			return true;
	}
	return super.onOptionsItemSelected(item);
}
 
Example 10
Project: AIMSICDL   File: DebugLogs.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case zz.aimsicd.lite.R.id.action_send_logs:
            sendEmail();
            return true;

        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);
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 11
Project: atlas   File: ItemDetailActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == 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.navigateUpTo(this, new Intent(this, ItemListActivity.class));
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 12
Project: PaoMovie   File: ItemDetailActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == 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.navigateUpTo(this, new Intent(this, ItemListActivity.class));
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 13
Project: Swift-Braille-Soft-keyboard   File: DotsStyleActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    try {
        switch (item.getItemId()) {
            case R.id.howToItem:
                Common.previousActivity = DotsLayoutActivity.class;
                Intent howToIntent = new Intent(this, WebViewActivity.class);
                howToIntent.putExtra("activity_title", getString(R.string.how_to_item));
                howToIntent.putExtra("web_url", getString(R.string.how_to_link));
                startActivity(howToIntent);
                break;
            case android.R.id.home:
                NavUtils.navigateUpFromSameTask(this);
                break;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return true;
}
 
Example 14
Project: Swift-Braille-Soft-keyboard   File: KeyboardDimensionActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    try {
        switch (item.getItemId()) {
            case R.id.howToItem:
                Common.previousActivity = KeyboardDimensionActivity.class;
                Intent howToIntent = new Intent(this, WebViewActivity.class);
                howToIntent.putExtra("activity_title", getString(R.string.how_to_item));
                howToIntent.putExtra("web_url", getString(R.string.how_to_link));
                startActivity(howToIntent);
                break;
            case android.R.id.home:
                NavUtils.navigateUpFromSameTask(this);
                break;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return true;
}
 
Example 15
Project: Swift-Braille-Soft-keyboard   File: DotsLayoutActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    try {
        switch (item.getItemId()) {
            case R.id.howToItem:
                Common.previousActivity = DotsLayoutActivity.class;
                Intent howToIntent = new Intent(this, WebViewActivity.class);
                howToIntent.putExtra("activity_title", getString(R.string.how_to_item));
                howToIntent.putExtra("web_url", getString(R.string.how_to_link));
                startActivity(howToIntent);
                break;
            case android.R.id.home:
                NavUtils.navigateUpFromSameTask(this);
                break;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return true;
}
 
Example 16
Project: Swift-Braille-Soft-keyboard   File: KeyboardLanguagesActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    try {
        switch (item.getItemId()) {
            case R.id.howToItem:
                Common.previousActivity = KeyboardLanguagesActivity.class;
                Intent howToIntent = new Intent(this, WebViewActivity.class);
                howToIntent.putExtra("activity_title", getString(R.string.how_to_item));
                howToIntent.putExtra("web_url", getString(R.string.how_to_link));
                startActivity(howToIntent);
                break;
            case android.R.id.home:
                NavUtils.navigateUpFromSameTask(this);
                break;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return true;
}
 
Example 17
Project: SmART-Form   File: TestFragment.java   View source code 6 votes vote down vote up
/**
 * Customize option bar
 * @param item
 * @return
    */
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch( item.getItemId() ){
		case android.R.id.home:
			if ( NavUtils.getParentActivityName(getActivity()) != null){
				NavUtils.navigateUpFromSameTask(getActivity());
			}
			return true;
		case edu.osu.siyang.smartform.R.id.menu_item_delete_single_test:
			AlertDialog diaBox = AskOption();
			diaBox.show();
			return true;
		default:
			return super.onOptionsItemSelected(item);
	}
}
 
Example 18
Project: pets   File: EditorActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // User clicked on a menu option in the app bar overflow menu
    switch (item.getItemId()) {
        // Respond to a click on the "Save" menu option
        case R.id.action_save:
            // insert the pet to database
            savePet();
            // close the windows with the forms
            finish();
            return true;
        // Respond to a click on the "Delete" menu option
        case R.id.action_delete:
            // Do nothing for now
            return true;
        // Respond to a click on the "Up" arrow button in the app bar
        case android.R.id.home:
            // Navigate back to parent activity (CatalogActivity)
            // if no changes, continue back to parent activity
            if (!mPetHasChanged) {
                NavUtils.navigateUpFromSameTask(EditorActivity.this);
                return true;
            }

            // if there are unsaved changes
            DialogInterface.OnClickListener discardButtonClickListener = new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // User clicked "Discard Button"
                    NavUtils.navigateUpFromSameTask(EditorActivity.this);
                }
            };

            // Show Dialog
            showUnsavedChangesDialog(discardButtonClickListener);
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 19
Project: MyAnimeViewer   File: AnimeDetailsActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
        Intent upIntent = new Intent(this, MainActivity.class);
        if (NavUtils.shouldUpRecreateTask(this, upIntent)) {
            // This activity is not part of the application's task, so create a new task
            // with a synthesized back stack.
            TaskStackBuilder.from(this)
                    .addNextIntent(upIntent)
                    .startActivities();
            finish();
        } else {
            // This activity is part of the application's task, so simply
            // navigate up to the hierarchical parent activity.
            NavUtils.navigateUpTo(this, upIntent);
        }
        return true;
    } else if (item.getTitle().equals("Settings")) {
        //startActivity(new Intent(this, Settings.class));
        finish();
        // overridePendingTransition(R.anim.hold, R.anim.push_out_to_left);
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 20
Project: android-mvvm-architecture   File: FeedActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        // Respond to the action bar's Up/Home button
        case android.R.id.home:
            Intent upIntent = NavUtils.getParentActivityIntent(this);
            upIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            if (NavUtils.shouldUpRecreateTask(this, upIntent)) {
                // This activity is NOT part of this app's task, so create a new task
                // when navigating up, with a synthesized back stack.
                TaskStackBuilder.create(this)
                        // Add all of this activity's parents to the back stack
                        .addNextIntentWithParentStack(upIntent)
                        // Navigate up to the closest parent
                        .startActivities();
            } else {
                // This activity is part of this app's task, so simply
                // navigate up to the logical parent activity.
                NavUtils.navigateUpTo(this, upIntent);
            }
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 21
Project: cat-is-a-dog   File: AddHabitEventActivity.java   View source code 6 votes vote down vote up
/**
 * Handler when menu item is selected
 * @param item
 * @return
 */
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    Log.d(TAG, "item:" + item.getItemId());
    switch (item.getItemId()) {
        // Respond to the action bar's Up/Home button
        case android.R.id.home:
            NavUtils.navigateUpFromSameTask(this);
            return true;
        case SAVE_BUTTON_ID:
            saveEvent();
            Toast.makeText(this, "Habit event saved!", Toast.LENGTH_SHORT).show();
            NavUtils.navigateUpFromSameTask(this);
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 22
Project: Treebolic   File: ServicesActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(@NonNull final MenuItem item)
{
	switch (item.getItemId())
	{
		case android.R.id.home:
			NavUtils.navigateUpFromSameTask(this);
			return true;

		case R.id.action_rescan:
			final BaseAdapter adapter = Services.makeAdapter(this, R.layout.item_services, from, to, true);
			final ListView listView = findViewById(R.id.services);
			listView.setAdapter(adapter);
			return true;
	}
	return super.onOptionsItemSelected(item);
}
 
Example 23
Project: android-mvp-architecture   File: FeedActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        // Respond to the action bar's Up/Home button
        case android.R.id.home:
            Intent upIntent = NavUtils.getParentActivityIntent(this);
            upIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            if (NavUtils.shouldUpRecreateTask(this, upIntent)) {
                // This activity is NOT part of this app's task, so create a new task
                // when navigating up, with a synthesized back stack.
                TaskStackBuilder.create(this)
                        // Add all of this activity's parents to the back stack
                        .addNextIntentWithParentStack(upIntent)
                        // Navigate up to the closest parent
                        .startActivities();
            } else {
                // This activity is part of this app's task, so simply
                // navigate up to the logical parent activity.
                NavUtils.navigateUpTo(this, upIntent);
            }
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 24
Project: lurkerhn   File: SettingsActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
    int id = item.getItemId();
    if (id == android.R.id.home) {
        if (!super.onMenuItemSelected(featureId, item)) {
            NavUtils.navigateUpFromSameTask(this);
        }
        return true;
    }
    return super.onMenuItemSelected(featureId, item);
}
 
Example 25
Project: covoiturage-libre-android   File: WebViewActivity.java   View source code 5 votes vote down vote up
private void goBack(){

        if(wvMainWeb!=null && wvMainWeb.canGoBack()){
            wvMainWeb.goBack();
        }else{
            NavUtils.navigateUpFromSameTask(this);
        }

    }
 
Example 26
Project: GitHub   File: AppCompatPreferenceActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	if (item.getItemId() == android.R.id.home) {
		NavUtils.navigateUpFromSameTask(this);
		return true;
	}

	return super.onOptionsItemSelected(item);
}
 
Example 27
Project: GitHub   File: AppCompatPreferenceActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            NavUtils.navigateUpFromSameTask(this);
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 28
Project: DebugOverlay-Android   File: ToolbarSupport.java   View source code 5 votes vote down vote up
public static void addTo(@NonNull final AppCompatActivity activity, @StringRes int toolBarTitle,
                         @ColorRes int toolBarBgColor) {
    Toolbar toolbar = getToolbar(activity);
    if (toolBarTitle != 0) {
        toolbar.setTitle(toolBarTitle);
    }
    if (toolBarBgColor != 0) {
        toolbar.setBackgroundColor(ContextCompat.getColor(activity, toolBarBgColor));
    }
    activity.setSupportActionBar(toolbar);

    if (hasParentActivity(activity)) {
        activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent upIntent = NavUtils.getParentActivityIntent(activity);
                if (NavUtils.shouldUpRecreateTask(activity, upIntent)) {
                    // This activity is NOT part of this app's task, so create a new task
                    // when navigating up, with a synthesized back stack.
                    TaskStackBuilder.create(activity)
                            // Add all of this activity's parents to the back stack
                            .addNextIntentWithParentStack(upIntent)
                            // Navigate up to the closest parent
                            .startActivities();
                } else {
                    // This activity is part of this app's task, so simply
                    // navigate up to the logical parent activity.
                    NavUtils.navigateUpTo(activity, upIntent);
                }
            }
        });
    }
}
 
Example 29
Project: DebugOverlay-Android   File: ToolbarSupport.java   View source code 5 votes vote down vote up
private static boolean hasParentActivity(Activity activity) {
    try {
        return NavUtils.getParentActivityName(activity) != null;
    } catch (IllegalArgumentException e) {
        // Component name of supplied activity does not exist...
        return false;
    }
}
 
Example 30
Project: divertsy-client   File: SettingsActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
    int id = item.getItemId();
    if (id == android.R.id.home) {
        if (!super.onMenuItemSelected(featureId, item)) {
            NavUtils.navigateUpFromSameTask(this);
        }
        return true;
    }
    return super.onMenuItemSelected(featureId, item);
}
 
Example 31
Project: divertsy-client   File: SettingsActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == android.R.id.home) {
        NavUtils.navigateUpFromSameTask(this.getActivity());
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 32
Project: divertsy-client   File: SettingsActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == android.R.id.home) {
        NavUtils.navigateUpFromSameTask(this.getActivity());
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 33
Project: divertsy-client   File: SettingsActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == android.R.id.home) {
        NavUtils.navigateUpFromSameTask(this.getActivity());
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 34
Project: home-assistant-Android   File: SettingsActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            Intent up = NavUtils.getParentActivityIntent(this);
            up.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
            NavUtils.navigateUpTo(this, up);
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 35
Project: SampleAppArch   File: ArtistDetailActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
  switch (item.getItemId()) {
    // Respond to the action bar's Up/Home button
    case android.R.id.home:
      NavUtils.navigateUpFromSameTask(this);
      return true;
  }
  return super.onOptionsItemSelected(item);
}
 
Example 36
Project: sa-android   File: MessageBoardActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            NavUtils.navigateUpFromSameTask(this);
            return true;

        case R.id.MessageBoardNewMessage:
            newPostDialog();
            return true;
    }
    return onOptionsItemSelected(item);
}
 
Example 37
Project: sflauncher   File: SettingsActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == android.R.id.home) {
        NavUtils.navigateUpFromSameTask(this);
        return true;
    }else if (id == R.id.action_license) {
        startActivity(new Intent(this, LicenseActivity.class));
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 38
Project: LivingBurger   File: SettingsActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
    int id = item.getItemId();
    if (id == android.R.id.home) {
        if (!super.onMenuItemSelected(featureId, item)) {
            NavUtils.navigateUpFromSameTask(this);
        }
        return true;
    }
    return super.onMenuItemSelected(featureId, item);
}
 
Example 39
Project: BlogBookApp   File: BrowserActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            NavUtils.navigateUpFromSameTask(this);
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
Example 40
Project: TreebolicPlugins   File: SettingsActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(@NonNull final MenuItem item)
{
	switch (item.getItemId())
	{
		case android.R.id.home:
			NavUtils.navigateUpFromSameTask(this);
			return true;
	}
	return super.onOptionsItemSelected(item);
}