i was working with back navigation and i found out some code to work with it. In the manifest file i tried to put my packagename and the class name but it says Activity Main does not have a parent acitivity.
Here is my manifest file
the package name is correct: edu.gannon.gannonknightnews
From what i learnt is that parent will be the .Main and the activity i want to go back to is from .NewsFragment. I think i did not fully grasped the concept. Could you clearify the mistake i have done?
THank you
<activity
android:name="edu.gannon.gannonknightnews.NewsFragment"
android:label="@string/title_activity_display_message"
android:parentActivityName="edu.gannon.gannonknightnews.Main" >
<!-- Parent activity meta-data to support 4.0 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="edu.gannon.gannonknightnews.Main" />
</activity>
and the onoptionsitemselected
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Log.d("MENU RETURN","CLICKED");
switch (item.getItemId()) {
// Respond to the action bar's Up/Home button
case android.R.id.home:
//Log.d("MENU RETURN","CLICKED");
NavUtils.navigateUpFromSameTask(getActivity());
return true;
}
return super.onOptionsItemSelected(item);
}