user2229066 user2229066 - 2 years ago 78
Java Question

How do I change the hierarchy parent of an activity?

At the moment it is main activity but I want to change it to the Categories activity.
Is this where the problem lies?

public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
// 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:
return true;
return super.onOptionsItemSelected(item);

Answer Source

Go to AndroidManifest.xml, find your Sport activity and add this code

<activity android:name="Sport" >
       android:value="PARENT_ACTIVITY_PATH" />

Substitute PARENT_ACTIVITY_PATH with the name of your parent activity adding also your package name (e.g. com.example.Categories).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download