Android 我的应用程序中的Int、EditText操作和TabHost错误

Android 我的应用程序中的Int、EditText操作和TabHost错误,android,android-edittext,android-tabhost,Android,Android Edittext,Android Tabhost,在Adroid Studio中制作我的第一个simply应用程序时,我被卡住了 1.) //从用户处获取号码 //接下来,Tmax必须,220-用户输入号码 这是用户输入的数字错误 (二) 我不知道它为什么不能正常工作 TabHost tabHost = (TabHost) findViewById(R.id.tabHost); TabHost.setup(); *//Why is error here?* TabHost.TabSpec tabSpec = tabHost.newTabSp

在Adroid Studio中制作我的第一个simply应用程序时,我被卡住了

1.)

//从用户处获取号码

//接下来,Tmax必须,220-用户输入号码

这是用户输入的数字错误

(二)

我不知道它为什么不能正常工作

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

TabHost.setup(); *//Why is error here?*

TabHost.TabSpec tabSpec = tabHost.newTabSpec("Calc"); 
tabSpec.setContent(R.id.Calc); 
tabSpec.setIndicator("Calc");
tabHost.addTab(tabSpec);

tabSpec = tabHost.newTabSpec("Hints"); *//second table, witchout [TabHost.TabSpac] ??*
tabSpec.setContent(R.id.Hints); 
tabSpec.setIndicator("Hints");
tabHost.addTab(tabSpec);

我有希望,有人会帮助我。

考虑到Wiek是您的
EditText
对象:

  • Tmax=220-Integer.valueOf(Wiek.getText().toString())

  • tabHost.setup()

  • 说明:

    Wiek是一个对象,首先需要调用getText来获取在对象内部输入的值

    TabHost
    是类名,
    TabHost
    是实例化视图

    EditText = Age;
    Age = (EditText) findViewById(R.id.inAge);
    
    Tmax = 220 - Age;
    
    Error47, 16) error: non-static method setup() cannot be referenced from a static context
    
    TabHost tabHost = (TabHost) findViewById(R.id.tabHost);
    
    TabHost.setup(); *//Why is error here?*
    
    TabHost.TabSpec tabSpec = tabHost.newTabSpec("Calc"); 
    tabSpec.setContent(R.id.Calc); 
    tabSpec.setIndicator("Calc");
    tabHost.addTab(tabSpec);
    
    tabSpec = tabHost.newTabSpec("Hints"); *//second table, witchout [TabHost.TabSpac] ??*
    tabSpec.setContent(R.id.Hints); 
    tabSpec.setIndicator("Hints");
    tabHost.addTab(tabSpec);