Android:让新的Activity保留在选项卡中

3
我有一个自定义的TabView,它显示一个ListActivity,但每次我点击列表项之一时,它都会导致一个新的活动并且TabView完全消失。
我的期望是,当我点击列表中的项目之一时,新的活动被显示并仍保留在选项卡内。
有人能帮助我改进我的代码吗?
这是我自定义的TabView的代码:
super.onCreate(savedInstanceState);
    // construct the tabhost
    setContentView(R.layout.project_tab);

    setupTabHost();

    setupTabL(new TextView(this), "Alle", (ProjectsList.class));
    setupTab(new TextView(this), "Kategorien", (CategoryList.class));
    setupTabR(new TextView(this), "Favorites", (ProjectsList.class));

    final Button refresh = (Button) findViewById(R.id.btn_project_refresh);
    refresh.setOnClickListener(refresh_listener);
}

private void setupTab(final View view, final String tag, final Class<?> context) {
    View tabview = createTabView(mTabHost.getContext(), tag);
    TabSpec ts1 = mTabHost.newTabSpec("tab1"); 
    ts1.setIndicator(tabview); 
    mTabHost.addTab(ts1);
}

private static View createTabView(final Context context, final String text) {
    View view = LayoutInflater.from(context).inflate(R.layout.inner_tab_m_bg, null);
    TextView tv = (TextView) view.findViewById(R.id.tabsText);
    tv.setText(text);
    return view;
}

以下是ListActivity代码中的onListItemClick片段:

protected void onListItemClick(ListView l, View v, int position, long id) {
        super.onListItemClick(l, v, position, id);
        Object o = this.getListAdapter().getItem(position);
        String choice = o.toString();
        if (choice .equals("Entwicklungshilfe")) {
            Intent i = new Intent(CategoryList.this, SubCategoryList.class);
            i.putExtra("category","'%Entwicklungshilfe%'");
            startActivityForResult(i,0);
网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接