{"id":2981,"date":"2014-03-13T00:13:13","date_gmt":"2014-03-13T00:13:13","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/13\/android-loading-local-asset-xml-as-url-collection-of-common-programming-errors\/"},"modified":"2014-03-13T00:13:13","modified_gmt":"2014-03-13T00:13:13","slug":"android-loading-local-asset-xml-as-url-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/13\/android-loading-local-asset-xml-as-url-collection-of-common-programming-errors\/","title":{"rendered":"Android: Loading Local Asset XML as URL-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m playing around with a custom listview using this tutorial:<\/p>\n<p>http:\/\/www.androidhive.info\/2012\/02\/android-custom-listview-with-image-and-text\/<\/p>\n<p>I&#8217;m running into an issue though with trying to modify it. If I want to use local android_assets instead of an XML file loaded from a web link, my app crashes. What I&#8217;m doing is changing this line:<\/p>\n<pre><code> static final String URL = \"http:\/\/api.androidhive.info\/music\/music.xml\";\n<\/code><\/pre>\n<p>to this:<\/p>\n<pre><code> static final String URL = \"file:\/\/\/android_asset\/music.xml\";\n<\/code><\/pre>\n<p>but when I do this, my app crashes on this line:<\/p>\n<pre><code> String xml = parser.getXmlFromUrl(URL); \/\/ getting XML from URL\n<\/code><\/pre>\n<p>Any help would be awesome. Thank you!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m playing around with a custom listview using this tutorial: http:\/\/www.androidhive.info\/2012\/02\/android-custom-listview-with-image-and-text\/ I&#8217;m running into an issue though with trying to modify it. If I want to use local android_assets instead of an XML file loaded from a web link, my app crashes. What I&#8217;m doing is changing this line: static final String URL = &#8220;http:\/\/api.androidhive.info\/music\/music.xml&#8221;; [&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-2981","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2981","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=2981"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2981\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2981"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2981"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2981"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}