Bug Running Android Tutorial HelloTabWidget under SDK 1.5: "setCurrentTag(getIntent())"

Posted by Matt J. on Stack Overflow See other posts from Stack Overflow or by Matt J.
Published on 2010-02-01T23:55:45Z Indexed on 2010/03/30 21:23 UTC
Read the original article Hit count: 626

Filed under:
|
|

does not compile. Indeed: even in 1.5, this api, getIntent(), is already listed as deprecated.

The error message I get complains that getIntent() does not return a String, but setCurrentTab() expects a string.

If I guess and change the line to read:

"tabHost.setCurrentTab(1); // was setCurrentTab(getIntent())",

then it compiles, builds, but does not run. I get the "stopped unexpectedly" error message from the emulator. I cannot even get Log.d to output, so it seems that it stops 'unexpectedly' very early.

So the first and main question is: what is the correct fix to "tabHost.setCurrentTab(getIntent())" in the final line of OnCreate() in http://developer.android.com/resources/tutorials/views/hello-tabwidget.html?

The second and simpler question is: did I guess right in replacing 'mTabHost' with tabHost in the one place where that occurs?

© Stack Overflow or respective owner

Related posts about android

Related posts about java