Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/200.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 从内容更改选项卡内容_Java_Android_Eclipse - Fatal编程技术网

Java 从内容更改选项卡内容

Java 从内容更改选项卡内容,java,android,eclipse,Java,Android,Eclipse,我有一个带标签的TabHost。我在管理它们方面没有问题,但我现在需要的是: 我在选项卡内容中调用了一个“活动”,我需要该活动/布局中的一个按钮更改选项卡的内容。我该怎么做?我找不到解决方案。为您的botton使用OnClickListener,使用findViewById并更改内容。有什么问题吗 更新 主要活动: Resources res = getResources(); TabHost tabHost = getTabHost(); TabHost.TabSpec

我有一个带标签的TabHost。我在管理它们方面没有问题,但我现在需要的是:
我在选项卡内容中调用了一个“活动”,我需要该活动/布局中的一个按钮更改选项卡的内容。我该怎么做?我找不到解决方案。

为您的botton使用OnClickListener,使用findViewById并更改内容。有什么问题吗

更新

主要活动:

    Resources res = getResources();
    TabHost tabHost = getTabHost();
    TabHost.TabSpec spec;
    Intent intent;

    intent = new Intent().setClass(this, CatalogActivity.class);
    String txtCatalog = (String) getText(R.string.catalog);
    spec = tabHost.newTabSpec("catalog").setIndicator(txtCatalog,
            res.getDrawable(R.drawable.ic_tab_catalog)).setContent(intent);
    tabHost.addTab(spec);
在儿童活动时(等于A):


也许我自己解释得不好。postimg.org/image/xzsdixh77(我无法上载图像)我需要通过单击按钮将内容A更改为内容C,但这需要发生在选项卡ContentI中,该选项卡是从我的旧项目更新而来,具有相同功能。现在,我将尝试查找我当时使用的教程。这是:和相关问题:
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {     
    if(!items.get(position).isGroup()){         
        Category item = (Category)items.get(position);          
        Intent newintent = new Intent(getBaseContext(), CategoryActivity.class);
        newintent.putExtra("pid", item.id);
        startActivity(newintent);
    }       
    super.onListItemClick(l, v, position, id);
}