Tab Layout tutorial doesn't work


Last Updated:

  1. iperez_geniua

    iperez_geniua Member This Topic's Starter

    Joined:
    Apr 12, 2010
    Messages:
    6
    Likes Received:
    0
    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 This Topic's Starter

    Joined:
    Apr 12, 2010
    Messages:
    6
    Likes Received:
    0
    can anyone help
     
  3. dmitriyk

    dmitriyk Active Member

    Joined:
    Apr 17, 2010
    Messages:
    44
    Likes Received:
    10
    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...