Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid xml parsing does not show results?
    primarykey
    data
    text
    <p>I am newbie to android, I am trying to parse xml data from <a href="http://www.astrology.com/horoscopes/daily-horoscope.rss" rel="nofollow noreferrer">http://www.astrology.com/horoscopes/daily-horoscope.rss</a>, I grab the code from <a href="https://stackoverflow.com/questions/12065951/how-can-i-parse-xml-from-url-in-android">How can I parse xml from url in android?</a> here, I used sherLock library, I also set internet permissions in manifest, but still unable to grab it, here is the same code except a little modification, </p> <pre><code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /* Create a new layout to display the view */ LinearLayout layout = new LinearLayout(this); layout.setOrientation(1); /* Create a new textview array to display the results */ TextView name[]; //TextView website[]; //TextView category[]; try { URL url = new URL("http://www.astrology.com/horoscopes/daily-horoscope.rss"); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(new InputSource(url.openStream())); doc.getDocumentElement().normalize(); NodeList nodeList = doc.getElementsByTagName("item"); /** Assign textview array lenght by arraylist size */ name = new TextView[nodeList.getLength()]; // website = new TextView[nodeList.getLength()]; //category = new TextView[nodeList.getLength()]; for (int i = 0; i &lt; nodeList.getLength(); i++) { Node node = nodeList.item(i); name[i] = new TextView(this); //website[i] = new TextView(this); //category[i] = new TextView(this); Element fstElmnt = (Element) node; NodeList nameList = ((Document) fstElmnt).getElementsByTagName("title"); Element nameElement = (Element) nameList.item(0); nameList = ((Node) nameElement).getChildNodes(); name[i].setText("Name = " + ((Node) nameList.item(0)).getNodeValue()); //category[i].setText("Website Category = " + ((org.w3c.dom.Element) websiteElement).getAttribute("category")); layout.addView(name[i]); //layout.addView(website[i]); //layout.addView(category[i]); } } catch (Exception e) { System.out.println("XML Pasing Excpetion = " + e); } /** Set the layout view to display */ setContentView(layout); } </code></pre> <p>Remember I am extending my MainActivity class from SherlockActivity, when I execute the code, only action bar appears!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload