how to stop application from crash if no network is available?
<p>how to set request time out in this code? this is my applciation which work fine if http server not responding or not available application is blast how do i set requesttime out in this applciation?? please helpme</p>

<pre><code>public class AgAppHelperMethods   {

       private static final String LOG_TAG = null;

           private static AgAppHelperMethods instance = null;
public static   String[][] AgAppXMLParser( String parUrl) {



    String _node,_element;
    String[][] xmlRespone = null;
    try {

            String url = "www.xxxx.com";
            URL finalUrl = new URL(url);    


            DocumentBuilderFactory dbf =   
  DocumentBuilderFactory.newInstance();
            DocumentBuilder db = dbf.newDocumentBuilder();
            Document doc = db.parse(new 
    InputSource(finalUrl.openStream()));
            doc.getDocumentElement().normalize();

            NodeList list=doc.getElementsByTagName("*");
            _node=new String();
            _element = new String();
            xmlRespone = new String[list.getLength()][2];

            //this "for" loop is used to parse through the
            //XML document and extract all elements and their
            //value, so they can be displayed on the device

            for (int i=0;i&lt;list.getLength();i++)
                {
                    Node value=list.item(i).      getChildNodes().item(0);
                    _node=list.item(i).getNodeName();
                    _element=value.getNodeValue();
                    xmlRespone[i][0] = _node;
                    xmlRespone[i][1] = _element;

                }

        }









 catch (Exception e)
 {

   Log.e(LOG_TAG, "Connection Error NET NOT WORKING", e);

 }
</code></pre>
