Android Activity Group - second activity always shows first activity menu
<p>I have one problem using ActivityGroup. I have two activities inside an ActivityGroup and both of them use a menu (overriding the onCreateOptionMenu and onOptionsItemSelected).</p>

<p>Both activity have different menus.</p>

<p>Well, the problem is that the second activity always show the first activity menu, </p>

<p>Any idea about this issue?</p>

<p>Below is my code</p>

<pre><code>public class myActivityGroup extends ActivityGroup {

----

    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);
            View view = window.getDecorView();
            history.add(view);
            setContentView(view);
        }
    }

        public void back() {
        if (history.size() &gt; 0) {
            int lastActivityIndex = history.size() - 1;
            int lastIDIndex = mIdList.size() - 1;

            String activityId = mIdList.get(lastIDIndex);
            Log.d(TAG, "activityId:" + activityId);

            history.remove(lastActivityIndex);
            mIdList.remove(lastIDIndex);
            setContentView(history.get(history.size() - 1));
        } else {
            finish();
        }
    }


 @Override
    public boolean onPrepareOptionsMenu(Menu menu) {
        Activity current = getLocalActivityManager().getCurrentActivity();   
        return current.onPrepareOptionsMenu(menu);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        LocalActivityManager manager = getLocalActivityManager();
        Activity current = manager.getCurrentActivity();
        return current.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        LocalActivityManager manager = getLocalActivityManager();
        Activity current = manager.getCurrentActivity();
        return current.onOptionsItemSelected(item);
    }
}



public class ChildActivity1 extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        //add menu here
         MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.settings_menu, menu);
        return true;
    }

    @Override
      public boolean onOptionsItemSelected(MenuItem item) {
        //handle on menu item selected here
        return true;
    }
}



public class ChildActivity2 extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);       
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        //add menu here
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.offer_menu, menu);
        return true;
    }

    @Override
   public boolean onOptionsItemSelected(MenuItem item) {
        //handle on menu item selected here
        return true;
    }
}
</code></pre>
