How to set parent activity of an activity programmatically in android?
<p>I have an activity 'A' in the application that I'm developing. This activity will be shown once I start the app. It can also be visited by selecting it from the overflow menu in the action bar. </p>

<p>I have configured the action bar of this activity 'A' in such a way that the <code>UP</code> icon will be displayed when it is selected from overflow menu and not when the activity appears during starting of the app.</p>

<p>But, this UP icon, when clicked, does not do anything because I have not set the parent activity in the manifest file. If the parent activity is set in the manifest file, I'm getting the UP icon in the same activity which appears when the app is started.</p>

<p>Flow: <code>StartApp-&gt; Activity A (without Up icon) -&gt; Home Screen -&gt; Overflow menu -&gt; Activity A (with up icon).</code></p>

<p>How do I set the parent activity for activity 'A' when Up icon appears ?</p>