Java Code Examples for android.support.v4.app.NavUtils#navigateUpFromSameTask()

The following examples show how to use android.support.v4.app.NavUtils#navigateUpFromSameTask() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EditTracksActivity.java    From tickmate with GNU General Public License v3.0 6 votes vote down vote up
@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);
		return true;
	case R.id.action_choose_track:
	case R.id.action_choose_track_menu:
		Intent intent = new Intent(this, ChooseTrackActivity.class);
	    startActivityForResult(intent, 1);			
		return true;
	}
	return super.onOptionsItemSelected(item);
}
 
Example 2
Source File: SettingsActivity.java    From XMouse with MIT License 6 votes vote down vote up
@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
            //
            // TODO: If Settings has multiple levels, Up should navigate up
            // that hierarchy.
            NavUtils.navigateUpFromSameTask(this);
            return true;

    }
    return super.onOptionsItemSelected(item);
}
 
Example 3
Source File: GraphsActivity.java    From good-weather with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.action_refresh:
            if (mConnectionDetector.isNetworkAvailableAndConnected()) {
                getWeather();
                setVisibleUpdating(true);
            } else {
                Toast.makeText(this,
                               R.string.connection_not_found,
                               Toast.LENGTH_SHORT).show();
            }
            return true;
        case R.id.action_toggle_values:
            toggleValues();
            return true;
        case R.id.action_toggle_yaxis:
            toggleYAxis();
            return true;
        case android.R.id.home:
            NavUtils.navigateUpFromSameTask(this);
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 4
Source File: CloudPageInboxActivity.java    From LearningAppAndroid with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Navigates back to parent's Activity: MainActivity
 *
 * @param item which is the reference to the parent's activity: MainActivity
 */
@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 5
Source File: EditTemplateActivity.java    From SmileEssence with MIT License 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_edit_list_add: {
            addNewTemplate();
            break;
        }
        case android.R.id.home: {
            NavUtils.navigateUpFromSameTask(this);
            return true;
        }
    }
    return true;
}
 
Example 6
Source File: AboutActivity.java    From ankihelper with GNU General Public License v3.0 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 7
Source File: ExportActivity.java    From SensorDashboard with Apache License 2.0 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 8
Source File: SearchActivity.java    From good-weather with GNU General Public License v3.0 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 9
Source File: SettingsActivity.java    From android-dev-challenge with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    // When the home button is pressed, take the user back to the VisualizerActivity
    if (id == android.R.id.home) {
        NavUtils.navigateUpFromSameTask(this);
    }
    return super.onOptionsItemSelected(item);
}
 
Example 10
Source File: SettingsActivity.java    From bitcoinpos with MIT License 5 votes vote down vote up
@Override
public void onBackPressed()
{
    NavUtils.navigateUpFromSameTask(this);

    super.onBackPressed();
}
 
Example 11
Source File: LicenseActivity.java    From SmileEssence with MIT License 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 true;
}
 
Example 12
Source File: SettingsActivity.java    From pretixdroid with GNU General Public License v3.0 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 13
Source File: MomentStatActivity.java    From WeChatMomentStat-Android with GNU General Public License v3.0 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.share_menu_btn:
            shareToTimeLine();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 14
Source File: SettingsActivity.java    From guitar-tuner with Apache License 2.0 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 15
Source File: VoiceSettingsActivity.java    From your-local-weather with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_voice_settings_language:
            startActivity(new Intent(VoiceSettingsActivity.this, VoiceLanguageOptionsActivity.class));
            return true;
        case android.R.id.home:
            NavUtils.navigateUpFromSameTask(this);
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 16
Source File: SettingsActivity.java    From MyOwnNotes with GNU General Public License v3.0 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:
	    	
	    	updateSettings();
	        NavUtils.navigateUpFromSameTask(this);
	    	return true;
	}
    return super.onOptionsItemSelected(item);
}
 
Example 17
Source File: EditCustomThemeActivity.java    From NumberPadTimePicker with Apache License 2.0 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.reset_to_defaults:
            CustomThemeModel.get(this).resetToDefaults(this);
            recreate();
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
Example 18
Source File: FirstExampleActivity.java    From Curve-Fit with Apache License 2.0 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 19
Source File: UsersActivity.java    From ChatApp with Apache License 2.0 4 votes vote down vote up
@Override
public void onBackPressed()
{
    NavUtils.navigateUpFromSameTask(this);
}
 
Example 20
Source File: SkypeCall.java    From skype-android-app-sdk-samples with MIT License 4 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    try {
        switch (item.getItemId()) {

            case android.R.id.home:
                if (mConversation != null && mConversation.canLeave()){
                    try {
                        mConversation.leave();
                    } catch (SFBException e) {
                        e.printStackTrace();
                    }
                }
                if ( mCallFragment != null) {
                    getSupportFragmentManager()
                            .beginTransaction()
                            .detach(mCallFragment)
                            .commit();
                }

                NavUtils.navigateUpFromSameTask(this);
                break;
            case R.id.pauseVideoMenuItem:
                if (mConversation.getVideoService().canSetPaused() == true) {
                    Log.i(
                            "SkypeCall",
                            "select pauseVideoMenuItem "
                                    );

                    mCallFragment.mConversationHelper.toggleVideoPaused();
                }

                break;
            case R.id.muteAudioMenuItem:

                break;
            case R.id.changeCamera:
                if (mConversation.getVideoService().canSetActiveCamera() == true) {
                    mCallFragment.mConversationHelper.changeActiveCamera();
                }
                break;
            default:
                return super.onOptionsItemSelected(item);
        }

    } catch (Throwable t) {
        if (t.getMessage() == null)
            Log.e("Asset", " ");
        else
            Log.e("Asset", t.getMessage());
    }
    return true;
}