{"id":555,"date":"2010-05-22T16:13:38","date_gmt":"2010-05-22T15:13:38","guid":{"rendered":"http:\/\/www.lightsoft.se\/?p=555"},"modified":"2010-05-22T16:13:38","modified_gmt":"2010-05-22T15:13:38","slug":"tab-layout-incomplete-at-googles-page-android-2-0","status":"publish","type":"post","link":"https:\/\/www.lightsoftai.com\/?p=555","title":{"rendered":"Tab Layout incomplete at google&#8217;s page [Android 2.0]"},"content":{"rendered":"<p>A lot of people have followed the tutorial in Google for making <a href=\"http:\/\/developer.android.com\/resources\/tutorials\/views\/hello-tabwidget.html\">Tab&#8217;s layout<\/a> in Android. I followed the guide but soon got into strange errors.. <\/p>\n<p>Bumping my head against the keyboard of reason that I did not find where the errors where, that was the cause of the application to crash each time.<\/p>\n<p>For those that still have problems, here is some change of the code that must be made:<\/p>\n<p><strong>Step 2<\/strong><br \/>\nWhen creating your activities in the manifest file (AndroidManifest.xml), it should looks like this afterwords:<\/p>\n<p>[sourcecode language=&#8221;java&#8221;]<br \/>\n&#8230;.<br \/>\n  <activity android:name=\".AlbumsActivity\"\n                  android:label=\"@string\/app_name\"\n                  android:theme=\"@android:style\/Theme.NoTitleBar\"><br \/>\n   <\/activity><br \/>\n  <activity android:name=\".ArtistsActivity\"\n                  android:label=\"@string\/app_name\"\n                  android:theme=\"@android:style\/Theme.NoTitleBar\"><br \/>\n  <\/activity><br \/>\n  <activity android:name=\".SongsActivity\"\n                  android:label=\"@string\/app_name\"\n                  android:theme=\"@android:style\/Theme.NoTitleBar\"><br \/>\n  <\/activity><br \/>\n&#8230;.<br \/>\n[\/sourcecode]<\/p>\n<p><strong>Step 3<\/strong><\/p>\n<p>The text says that only create ic_tab_artist.xml file, but you will need to create the once for both songs and albums. Therefore create <strong>ic_tab_songs.xml<\/strong> and <strong>ic_tab_albums.xml<\/strong> and dublicate the data from <strong>ic_tab_artists.xml<\/strong> into both these new files.<\/p>\n<p><strong>Step 4<\/strong><\/p>\n<p>The third to last line under \/res\/layout\/main has a typo, it should be a <strong>;<\/strong> instead of an <strong>:<\/strong><br \/>\n[sourcecode language=&#8221;java&#8221;]<br \/>\n&#8230;.<br \/>\nandroid:padding=&#8221;5dp&#8221; \/><br \/>\n    <\/LinearLayout><br \/>\n&#8230;.<br \/>\n[\/sourcecode]<\/p>\n<p><strong>Step 6<\/strong><\/p>\n<p>There is an error when calling mTabHost, it should be tabHost.<\/p>\n<p>Then on the last line there is a fault, when using <strong>getIntent()<\/strong>.<br \/>\nChange this to:<br \/>\n[sourcecode language=&#8221;java&#8221;]<br \/>\ntabHost.setCurrentTabByTag(&#8220;albums&#8221;);<br \/>\n[\/sourcecode]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A lot of people have followed the tutorial in Google for making Tab&#8217;s layout in Android. I followed the guide but soon got into strange errors.. Bumping my head against the keyboard of reason that I did not find where the errors where, that was the cause of the application to crash each time. For [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[50,45],"class_list":["post-555","post","type-post","status-publish","format-standard","hentry","category-coding","tag-android-2-0","tag-development"],"_links":{"self":[{"href":"https:\/\/www.lightsoftai.com\/index.php?rest_route=\/wp\/v2\/posts\/555","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lightsoftai.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lightsoftai.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lightsoftai.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lightsoftai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=555"}],"version-history":[{"count":7,"href":"https:\/\/www.lightsoftai.com\/index.php?rest_route=\/wp\/v2\/posts\/555\/revisions"}],"predecessor-version":[{"id":616,"href":"https:\/\/www.lightsoftai.com\/index.php?rest_route=\/wp\/v2\/posts\/555\/revisions\/616"}],"wp:attachment":[{"href":"https:\/\/www.lightsoftai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=555"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lightsoftai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=555"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lightsoftai.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}