Android 如何关闭活动组内的活动?

Android 如何关闭活动组内的活动?,android,Android,我有一个包含两个活动的活动组。从第一个活动到第二个活动。我在第二个活动中有一个关闭按钮。当我在那里做一个结束时,我应该结束第二个活动,第一个活动应该带有它之前拥有的数据。这意味着我不能在完成“关闭”时调用第一个活动的意图。因为第一个活动中的数据将发生变化。我怎样才能做到这一点?我让它工作了。在activity group类中,给出以下代码: RelativeLayout landingLayout = (RelativeLayout) findViewById(R.id.landingL

我有一个包含两个活动的活动组。从第一个活动到第二个活动。我在第二个活动中有一个关闭按钮。当我在那里做一个结束时,我应该结束第二个活动,第一个活动应该带有它之前拥有的数据。这意味着我不能在完成“关闭”时调用第一个活动的意图。因为第一个活动中的数据将发生变化。我怎样才能做到这一点?

我让它工作了。在activity group类中,给出以下代码:

    RelativeLayout landingLayout = (RelativeLayout) findViewById(R.id.landingLayout);
    private static ArrayList<View> history;
    history = new ArrayList<View>();

    if (history.size() > 1) {
        history.remove(history.size() - 1);
        View view = history.get(history.size() - 1);
        replaceLandingView(view);
    } else {
        finish();
    }

    protected void replaceLandingView(View view) {
        landingLayout.removeAllViews();
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
        landingLayout.addView(view, params);
    }
RelativeLayout着陆布局=(RelativeLayout)findViewById(R.id.landingLayout);
私有静态数组列表历史;
历史=新的ArrayList();
if(history.size()>1){
history.remove(history.size()-1);
View=history.get(history.size()-1);
替换着陆视图(视图);
}否则{
完成();
}
受保护的void replaceLandingView(视图){
landingLayout.removeAllViews();
RelativeLayout.LayoutParams params=新的RelativeLayout.LayoutParams(
LayoutParams.FILL\u父级,LayoutParams.FILL\u父级);
landingLayout.addView(视图,参数);
}