Java - XML Pull Parser not working
===

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?

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");
        }
    
        
    }

XML:

    <item>
    <tag>hallo</tag>
    </item>


thank you for every tip. 