1. Check out our app, Forums for Android! Download and leave feedback here!

Tab Layout tutorial doesn't work

Discussion in 'Application Development' started by iperez_geniua, Apr 13, 2010.

  1. iperez_geniua

    iperez_geniua Member
    Thread Starter
    5

    Apr 12, 2010
    6
    0
    5
    I have followed the setup instructions from this web page

    Tab Layout | Android Developers

    there were some minor typos which i have ammended but i can't run the code because i have one error that i can't solve.

    the last line in the onCreate function that lives in the main java file

    tabHost.setCurrentTab(getIntent());

    has an error.

    The method setCurrentTab(int) in the type TabHost is not applicable for the arguments (Intent) HelloTabWidge.java

    the suggestion is to change it to

    tabHost.setCurrentTabByTag(getIntent());

    but this receives exactly the same error.

    So i can't run my app until this is resolved. can anyone help me out with this.

    Ilan
     

    Advertisement

  2. iperez_geniua

    iperez_geniua Member
    Thread Starter
    5

    Apr 12, 2010
    6
    0
    5
    can anyone help
     
  3. dmitriyk

    dmitriyk Active Member
    18

    Apr 17, 2010
    44
    10
    18
    Software Developer
    Salt Lake City, UT
    Using tabHost.setCurrentTab(0) will select the first tab.

    Alternately, you can use tabHost.setCurrentTabByTag() with the string that you used in the newTabSpec() method to select a tab. For example, if you were following that tutorial, you could use tabHost.setCurrentTabByTag("artists")
     

Share This Page

Loading...