インターネット接続が利用できない場合にエラーを表示する、アクティビティを拡張しないクラスがあります
インターネットが利用可能な場合は正常に機能しますが、インターネットが利用できない場合、またはサーバーがビジーの場合、アプリケーションフォースは閉じます。これを防ぐにはどうすればよいですか?メインアクティビティクラスでキャッチブロックメッセージを出力するにはどうすればよいですか?
利用可能なネットワークがない場合にアプリケーションがクラッシュするのを防ぐにはどうすればよいですか?
   public class AgAppHelperMethods   {
  private static final String LOG_TAG = 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];
            for (int i=0;i<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;
                }//end for
        }//end try
 catch (Exception e)
 {
     Log.e(LOG_TAG, "Connection Error NET NOT WORKING", e);
     }
    return xmlRespone;         
}
        public class LoginScreen extends Activity implements Serializable {
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.agapplogin);
          btnLogin = (Button) findViewById(R.id.btnLogin);
            btnLogin.setOnClickListener(new OnClickListener() {
                            public  void  
          onClick(View     view) {
            postLoginData();
             public void postLoginData()
{
             xmlRespone = AgAppHelperMethods.AgAppXMLParser( "www.xxx.com);
        Intent i = new Intent(this.getApplicationContext(),   
      Activity2.class);
        Bundle bundle = new Bundle();
        bundle.putSerializable("xmlResponee", xmlRespone.toString());
        i.putExtras(bundle);
        //i.putExtra("OBJECT", xmlRespone)