I am navigating to Android activity A from different activities. Depending on which activity, A is called from, I may or may not want to provide up-navigation on A.
intent.putExtra("ShouldProvideUpNav", true); // or false
I read this intent extra in A's onCreate(Bundle savedInstanceState)
shouldProvideUpNav = intent.getBooleanExtra("ShouldProvideUpNav", false);
I am not sure where I should use this boolean to disable the up navigation if the value is false. Any help will be appreciated.
You can do this from within your onCreate() method. Depending on what you would like enabled you can set both of these attributes accordingly there.
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setHomeButtonEnabled(false);
of which you can get your ActionBar
through getActionBar()
if desired.