Android的 - getTabHost()是未定义 [英] Android - getTabHost() is undefined

查看:107
本文介绍了Android的 - getTabHost()是未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始学习Java以及如何为Android程序前晚:)

I started learning Java and how to program for Android last night :)

到目前为止,我在这个教程:developer.android.com/resources/tutorials/views/hello-tabwidget.html

So far I'm on this tutorial: developer.android.com/resources/tutorials/views/hello-tabwidget.html

显然,这些教程已经被设计的人已经有Java开发经验。

Clearly these tutorials have been designed for people that already have experience with Java.

尽管缺少所需的所有步骤(一个绝对的初学者使用Java),甚至有一个错字的教程,看来我已经想通了一切(这我真的很自豪:P)。除了我无法弄清楚如何解决 TabHost tabHost = getTabHost(); 这显然是不确定的。

Despite the tutorial lacking all the required steps (for an absolute beginner with Java) and even having a typo, it seems I've figured everything out (which I'm really proud of :p). Except I cannot figure out how to fix TabHost tabHost = getTabHost(); which apparently is undefined.

我在下面的链接图像显示一个其他错误,但我不明白为什么。

I have one other error shown in the linked image below, but I don't see why.

下面是链接的图像

谢谢,加雷思

推荐答案

您刚刚错过本教程的步骤5中。

You just missed step 5 of the tutorial.

另一个错误是由于在TabHost的大写字母T。你想: tabHost.addTab(规范);

The other error is due to the capital T on TabHost. You want: tabHost.addTab(spec);

Java是大小写敏感的,所以它的确与众不同(调用TabHost类的非exsistant静态方法与调用由tabHost变量引用的对象上的实例方法)。

Java is case sensitive, so it makes a difference (calling a non-exsistant static method of the TabHost class vs. calling an instance method on the object referenced by the tabHost variable).

这篇关于Android的 - getTabHost()是未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆