SAX Parser not working in Android 4.0+ but in 2.3.3
===

my SAX parser does not work in Android 4.0+ but in 2.3.3, everytime it crashes on Android 4.0.

Can somebody tell why?

My Sax Parser:

**Activity:**

  
    
    public class MedalActivity extends SherlockActivity implements OnItemClickListener {
    	
        ListView lview3;
        ListViewCustomAdapter2 adapter;
        private ArrayList<Object> itemList;
        private ItemBean2 bean;
    	XMLGettersSetters data;
         
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.medals);
            getSupportActionBar().setIcon(R.drawable.home_ic);
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    try {
    			
    			/**
    			 * Create a new instance of the SAX parser
    			 **/
    			SAXParserFactory saxPF = SAXParserFactory.newInstance();
    			SAXParser saxP = saxPF.newSAXParser();
    			XMLReader xmlR = saxP.getXMLReader();
    
    			
    			URL url = new URL("my_url"); // URL of the XML
    			
    			/** 
    			 * Create the Handler to handle each of the XML tags. 
    			 **/
    			XMLHandler myXMLHandler = new XMLHandler();
    			xmlR.setContentHandler(myXMLHandler);
    			xmlR.parse(new InputSource(url.openStream()));
    			
    		} catch (Exception e) {
    			System.out.println(e);
    		}
    
    		data = XMLHandler.data;
            prepareArrayLits();
            
            
            lview3 = (ListView) findViewById(R.id.listView2);
            
            adapter = new ListViewCustomAdapter2(this, itemList);
            lview3.setAdapter(adapter);
            
            [...]
        
    
        
    }



**XMLGettersSetters** 

    public class XMLGettersSetters {

	private ArrayList<String> title = new ArrayList<String>();
	private ArrayList<String> artist = new ArrayList<String>();
	private ArrayList<String> country = new ArrayList<String>();
	private ArrayList<String> company = new ArrayList<String>();
	private ArrayList<String> price = new ArrayList<String>();
	private ArrayList<String> year = new ArrayList<String>();

	public ArrayList<String> getCompany() {
		return company;
	}

	public void setCompany(String company) {
		this.company.add(company);
		
	}

	public ArrayList<String> getPrice() {
		return price;
	}

	public void setPrice(String price) {
		this.price.add(price);
	
	}

	public ArrayList<String> getYear() {
		return year;
	}

	public void setYear(String year) {
		this.year.add(year);
		
	}

	public ArrayList<String> getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title.add(title);
		
	}

	public ArrayList<String> getArtist() {
		return artist;
	}

	public void setArtist(String artist) {
		this.artist.add(artist);

	}

	public ArrayList<String> getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country.add(country);
		
	}

}

**XMLHandler** 

    public class XMLHandler extends DefaultHandler {
    
    	String elementValue = null;
    	Boolean elementOn = false;
    	public static XMLGettersSetters data = null;
    
    	public static XMLGettersSetters getXMLData() {
    		return data;
    	}
    
    	public static void setXMLData(XMLGettersSetters data) {
    		XMLHandler.data = data;
    	}
    
    	/** 
    	 * This will be called when the tags of the XML starts.
    	 **/
    	@Override
    	public void startElement(String uri, String localName, String qName,
    			Attributes attributes) throws SAXException {
    
    		elementOn = true;
    
    		if (localName.equals("data"))
    		{
    			data = new XMLGettersSetters();
    		} else if (localName.equals("list")) {
    			
    		}
    	}
    
    	/** 
    	 * This will be called when the tags of the XML end.
    	 **/
    	@Override
    	public void endElement(String uri, String localName, String qName)
    			throws SAXException {
    
    		elementOn = false;
    
    		/** 
    		 * Sets the values after retrieving the values from the XML tags
    		 * */ 
    		if (localName.equalsIgnoreCase("item1"))
    			data.setTitle(elementValue);
    		else if (localName.equalsIgnoreCase("item2"))
    			data.setArtist(elementValue);
    		else if (localName.equalsIgnoreCase("item3"))
    			data.setCountry(elementValue);
    		else if (localName.equalsIgnoreCase("item4"))
    			data.setCompany(elementValue);
    		else if (localName.equalsIgnoreCase("item5"))
    			data.setPrice(elementValue);
    		else if (localName.equalsIgnoreCase("item6"))
    			data.setYear(elementValue);
    	}
    
    	/** 
    	 * This is called to get the tags value
    	 **/
    	@Override
    	public void characters(char[] ch, int start, int length)
    			throws SAXException {
    
    		if (elementOn) {
    			elementValue = new String(ch, start, length);
    			elementOn = false;
    		}
    
    	}
    
    }



Thanks