Domanda

How to open a child Activity of ActivityGroup in Tab. I want to open a child activity from a status bar notification with Tab. I called activity directly but tabs are not visible. Anyone knows how to open an Activity of ActivityGroup.

È stato utile?

Soluzione

Use this as reference, this will help you to resolve your issue.Here calling child activity explained beautifully.

http://ericharlow.blogspot.in/2010/09/experience-multiple-android-activities.html

Below is the answer of your question if you dont want go with that detailed URL

Create the

ArrayList<String> mIdList = new ArrayList<String> in the onCreate() of ActivityGroup class.

NOTE: This mIdList helps you when you will come back to previous activity.

Create a method in your class which extends ActivityGroup like this:

public void startChildActivity(String Id, Intent intent) {   
      Window window = getLocalActivityManager().startActivity(Id,intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));

      if (window != null) {
          mIdList.add(Id);
          setContentView(window.getDecorView()); 
      }    
  }

And In your main class which extends Activity do this:

Intent goOrderScreenActivity = new Intent(getParent(), CustomerInfoActivity.class);
            goOrderScreenActivity.putExtra("Flag", 1);
            **YourClassObjectWhichExtendsACtivityGroup** parentActivity = (YourClassObjectWhichExtendsACtivityGroup)getParent();
            parentActivity.startChildActivity("YOUR_ID", goOrderScreenActivity);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top