在Tab失败中启动活动

时间:2017-02-04 17:35:02

标签: android android-studio android-tabactivity

在我的应用程序中,我想在我的选项卡中启动活动。因此,不同的选项卡应包含不同项目的不同活动。每个活动都是一个导入的模块项目,单独构建和测试。问题出现在我构建我的应用程序时,它崩溃了。

MainActivity

Error: Invalid monitorOptions options child "reporters" fails because ["reporters" must be an object]
at Object.exports.assert (/home/rodrigo/Projetos/estudos/api/greetings-hapi/node_modules/hoek/lib/index.js:736:11)
at Object.exports.register (/home/rodrigo/Projetos/estudos/api/greetings-hapi/node_modules/good/lib/index.js:31:10)
at Object.target [as register] (/home/rodrigo/Projetos/estudos/api/greetings-hapi/node_modules/hapi/node_modules/joi/lib/object.js:77:34)
at each (/home/rodrigo/Projetos/estudos/api/greetings-hapi/node_modules/hapi/lib/plugin.js:318:14)
at iterate (/home/rodrigo/Projetos/estudos/api/greetings-hapi/node_modules/hapi/node_modules/items/lib/index.js:36:13)
at Object.exports.serial (/home/rodrigo/Projetos/estudos/api/greetings-hapi/node_modules/hapi/node_modules/items/lib/index.js:39:9)
at internals.Plugin.register (/home/rodrigo/Projetos/estudos/api/greetings-hapi/node_modules/hapi/lib/plugin.js:321:11)
at Object.<anonymous> (/home/rodrigo/Projetos/estudos/api/greetings-hapi/server.js:26:8)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)

ProjectView

记录:

package sst1.emily.example.com.sst1;

import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.TabHost;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        TabHost host = (TabHost)findViewById(R.id.tabHost);
        host.setup();

 //Tab 1
        TabHost.TabSpec spec = host.newTabSpec("Tab One");
        spec.setIndicator("Tab One");
        host.addTab(spec);
        Intent intent = new Intent();
        intent.setClassName("attendance.emily.example.com.attendance", "MainActivity");
        spec.setContent(intent);

        //Tab 2
        spec = host.newTabSpec("Tab Two");
        spec.setContent(R.id.tab2);
        spec.setIndicator("Tab Two");
        host.addTab(spec);

        //Tab 3
        spec = host.newTabSpec("Tab Three");
        spec.setContent(R.id.tab3);
        spec.setIndicator("Tab Three");
        host.addTab(spec);
    } }

知道哪个部分我做错了?

1 个答案:

答案 0 :(得分:1)

活动标签已被弃用六年。他们从不支持来自其他应用的活动。