使用tabbar环境启动新活动

时间:2012-01-09 22:05:02

标签: android tabs

     host.addTab(host.newTabSpec("Offers")
            .setIndicator("Offers", getResources().getDrawable(R.drawable.icon_light))
            .setContent(new Intent(this, List_Items.class)));


       host.addTab(host.newTabSpec("Account")
            .setIndicator("Account", getResources().getDrawable(R.drawable.icon_wrench))
            .setContent(new Intent(this, Offer_Popup.class)));


   BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            // TODO Auto-generated method stub
            String action=intent.getAction();

            if (action.equals("newstuff"))
            {

                 Intent intent2= new Intent(context, NewStuff.class);
                 startActivity(intent2);
            }

        }

        };


    IntentFilter filter=new IntentFilter("newstuff");
    this.registerReceiver(mBroadcastReceiver, filter);

现在,我在tabbars环境中有两个标签,还有一个广播监听器,如果匹配“newstuff”动作,那么它将启动一个NewStuff类活动,但这样,它掩盖了我的标签栏环境。如何从侦听器启动新活动,使其不会覆盖我的标签栏?

0 个答案:

没有答案