how to check whether data is returned or not in android?
<p>I'm making an application in which I have to do XML parsing.</p>

<p>I have to check if the user is able to access new data only then I have to delete the old data in the database.</p>

<p>For the above I am using the following code:</p>

<pre><code>try{
      URL url = new URL(address);
      /* Get a SAXParser from the SAXPArserFactory. */
      SAXParserFactory spf = SAXParserFactory.newInstance();
      SAXParser sp = spf.newSAXParser();
      /* Get the XMLReader of the SAXParser we created. */
      XMLReader xr = sp.getXMLReader();
      /* Create a new ContentHandler and apply it to the XML-Reader */
      xr.setContentHandler(this);
      /* Parse the xml-data from our URL. */
      InputSource is = new InputSource(url.openStream());
      //once data is obtained then delete the table.
      hb.executeSql("DELETE FROM Products,Category");
      xr.parse(is);
 }
 catch{
   e.printstacktrace();
 }
</code></pre>

<p>If there is an error in the input stream then an exception will be thrown which I'm catching and the code for deleting the table will never be executed.</p>

<p>Is the logic correct?</p>
