Android - getTabHost () - undefined

I started learning Java and how to program Android yesterday :)

I am still in this tutorial: developer.android.com/resources/tutorials/views/hello-tabwidget.html

Obviously, these tutorials were designed for people who already have experience with Java.

Despite the fact that the tutorial did not have all the necessary steps (for an absolute beginner with Java) and even with typos, it seems that I understood everything (that I'm really proud of: p). Also, I cannot figure out how to fix TabHost tabHost = getTabHost();that, which is apparently undefined.

I have another error shown in the linked image below, but I don't understand why.

Here is a related image .

Thanks Gareth

+3
source share
3 answers

You just skipped step five of the tutorial.

Another mistake is related to capital T on TabHost. Do you want to:tabHost.addTab(spec);

Java is case-sensitive, so it matters (invoking a non-existent static method of the TabHost class against invoking the instance method of the object referenced by the tabHost variable).

+6
source

getTabHost () - method TabActivity not Activity. You will need to expand this instead of Activity for the method that will be defined in your object.

+23
source

, TabActivity API 13, "" . , , DONUT.

0
source

Source: https://habr.com/ru/post/1744219/


All Articles