开发者

How to keep the header of a Tab in a SubActivity?

i've got this Tabhost:

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

        /** Initialization Tab1 */
        intent = new Intent(this, Tab1.Class);
        spec = tabHost.newTabSpec("Ta开发者_Go百科b1").setIndicator("Tab1").setContent(intent);
        tabHost.addTab(spec);

        /** Initialization Tab2 */      
        intent = new Intent(this, Abstand.class);
        spec = tabHost.newTabSpec("Tab2").setIndicator("Tab2").setContent(intent);
        tabHost.addTab(spec);

        tabHost.setCurrentTab(0); 

The content of Tab2 has some buttons, when one of these is clicked, it starts a SubActivity with:

    final Intent i = new Intent(this, SubActivity.class);
    final Bundle b = new Bundle();

    this.mButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            b.putString("key", "value");
            i.putExtras(b);
            startActivityForResult(i, REQUEST_CODE);
        }
    });

Within the SubActivity, the Tabhost isnt available anymore... so how can the Code be changed, showing the Tabhost in a SubActivity?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜