【问题标题】:Passing string from child tab activity to parent tab将字符串从子选项卡活动传递到父选项卡
【发布时间】:2012-07-08 03:35:41
【问题描述】:

我有一个活动名称“标签”。它启动 4 个不同的选项卡,每个选项卡都有自己的活动。它使用:

th = (TabHost) findViewById(R.id.tabhost);
    th.setup(this.getLocalActivityManager());
    TabSpec specs = th.newTabSpec("Tag1");
    Intent tabSelection = new Intent (this, ProfileSettings.class);

    tabSelection.putExtras(gotSettings);
    specs.setContent(tabSelection);
    specs.setIndicator("Settings",
            getResources().getDrawable(R.drawable.ic_menu_friendslist));
    th.addTab(specs);

    specs = th.newTabSpec("Tag2");
    tabSelection = new Intent (this,InternationalRoamingService.class);
    specs.setContent(tabSelection);
    specs.setIndicator("IRS", getResources().getDrawable(R.drawable.ic_menu_mapmode));
    th.addTab(specs);

    specs = th.newTabSpec("Tag3");
    tabSelection = new Intent (this,Call.class);
    specs.setContent(tabSelection);
    specs.setIndicator("Call", getResources().getDrawable(R.drawable.call));
    th.addTab(specs);

    specs = th.newTabSpec("Tag4");
    tabSelection = new Intent (this,WebSMS.class);
    specs.setContent(tabSelection);
    specs.setIndicator("SMS", getResources().getDrawable(R.drawable.ic_menu_start_conversation));
    th.addTab(specs);

将包“gotSettings”从父级传递给子级时没有问题。但是如何从子活动更新捆绑包的值或将值从子活动传递给父活动?

【问题讨论】:

    标签: android android-intent tabs bundle parent-child


    【解决方案1】:

    你有两种方法:

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-09-29
    • 1970-01-01
    • 2021-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-11
    • 2015-02-12
    相关资源
    最近更新 更多