문제

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.

도움이 되었습니까?

해결책

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);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top