Question: I am developing an application and would like to reuse activities that are similar in order to not keep replicating almost identical code.
 Let's imagine I have 4 activities:
- MainActivity
- Task1Activity
- Task2Activity
- MenuActivity

The Task1Activity or Task2Activity are really similar so I want to create just one activity called TaskActivity and pass some data via Intent to control within the TaskActivity the different behaviour.
 We can consider for simplification that the difference will only be the navigation flow.
 The navigation flow I would like to implement is:

MainActivity <-> MenuActivity <-> Task1Activity

```
                   or

```

MainActivity <-> Task2Activity

If I can reuse the TaskActivity in 2 different places in my navigation flow I would have:

MainActivity <-> MenuActivity <-> TaskActivity

```
                   or

```

MainActivity <-> TaskActivity

The problem is that when I define the TaskActivity in my manifest file I need to add something like:

```
   <activity
        android:name="br.com.example.TaskActivity"
        android:label="Just an example"
        android:launchMode="singleTask"
        android:configChanges="orientation"
        android:parentActivityName="br.com.example.MainActivity" >
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="br.com.example.MainActivity" />
    </activity>

```

During the TaskActivity definition above, I nee to tell what Activity will be my PARENT\_ACTIVITY.
 But the parent activity for this example can be MenuActivity or MainActivity.
 How can I define my TaskActivity without specifying what will be the parent activity?
 If there is a way to do it, should I expect any issue when pressing the back button in Android?

Thanks,
Carlos

Answer: 
Why do you need to include the meta-data for PARENT\_ACTIVITY in the Manifest? Is that some restriction for what you are doing? You can declare your activity in your AndroidManifest without the meta-data for PARENT\_ACTIVITY, so your problem will be solved.
After some research, I found that the PARENT\_ACTIVITY is used for the button UP in newer android versions. As I don't want to take any risk and I have no how to test in newer android versions, I decided to have the PARENT\_ACTIVITY for all my activities as my MainActivity.
For the code reuse, I will use heritage.