{"id":7210,"date":"2014-05-28T02:19:59","date_gmt":"2014-05-28T02:19:59","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/28\/two-columns-for-listview-or-tablelayout-in-landscape-mode-collection-of-common-programming-errors\/"},"modified":"2014-05-28T02:19:59","modified_gmt":"2014-05-28T02:19:59","slug":"two-columns-for-listview-or-tablelayout-in-landscape-mode-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/28\/two-columns-for-listview-or-tablelayout-in-landscape-mode-collection-of-common-programming-errors\/","title":{"rendered":"Two columns for ListView or TableLayout in Landscape mode-Collection of common programming errors"},"content":{"rendered":"<p>I recommend using a ListView rather than a TableLayout, since ListViews only create enough Views to fill the screen while a TableLayout will create every resource whether they are visible or not. In this way a TableLayout is slower and might even crash your app.<\/p>\n<p>You can check the device&#8217;s orientation with one of the answers from: Check orientation on Android phone. Then if the orientation is:<\/p>\n<ul>\n<li>landscape, load your double View layout.<\/li>\n<li>portrait, load your basic, single View layout.<\/li>\n<\/ul>\n<p>Loading different layouts in a ListView requires a simple custom Adapter. If you haven&#8217;t written one before, here is a tutorial to help you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recommend using a ListView rather than a TableLayout, since ListViews only create enough Views to fill the screen while a TableLayout will create every resource whether they are visible or not. In this way a TableLayout is slower and might even crash your app. You can check the device&#8217;s orientation with one of the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7210","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7210","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7210"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7210\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}