Java - XML Pull Parser not working
<p>I tried to use an example XML Pull Parser I found online, but for some reason I t does not work. Can somebody say why?</p>

<p>Code:</p>

<pre><code>public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        TextView txtv = (TextView) findViewById(R.id.textview2);
        try {
            txtv.setText(parseInputStream());
        } catch (Exception e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        try {
            txtv.setText(parseInputStream());
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    public String parseInputStream() throws Exception 
    {   InputStream input = new URL("my website. see xml below").openStream();
        XmlPullParser parser = Xml.newPullParser();
        parser.setInput(input, null);

            int eventType = parser.getEventType();
            while (eventType != XmlPullParser.END_DOCUMENT) {

                switch (eventType){
                    case XmlPullParser.START_DOCUMENT:
                        break;
                    case XmlPullParser.START_TAG:

                        String tagName = parser.getName();
                        if (tagName.equalsIgnoreCase("tag")) 
                        {
                            String statusText = parser.nextText();

                            return statusText;
                        }
                }
                eventType = parser.next();
            }

            // No status tag found so throw an exception
            throw new RuntimeException("No Status tag found in XML document");
    }


}
</code></pre>

<p>XML:</p>

<pre><code>&lt;item&gt;
&lt;tag&gt;hallo&lt;/tag&gt;
&lt;/item&gt;
</code></pre>

<p>thank you for every tip. </p>
