boolean flag value always show negative
<p>after long  effort i diagnose my problem in this code is,  if <code>flag</code> is going to false in <code>catch</code> block  is never go true.. even if i give valid input<br>
 do tell me how is it? how to solve that issue   when flag value goes to false in catch block is always show false after 1 time is false and print invalid input message if i give correct  input</p>

<pre><code>        public class AgAppHelperMethods   {

     private static final String LOG_TAG = null;

   private static AgAppHelperMethods instance = null;
      static boolean flag=true;

   public static String varMobileNo;
    public static String varPinNo;

   String[][] xmlRespone = null;





    public static AgAppHelperMethods getInstance() 
   {
       if(instance == null) 
          {
              instance = new AgAppHelperMethods();
          }
      return instance;
   }





public static   String[][] AgAppXMLParser( String parUrl) {


    String _node,_element;
     String[][] xmlRespone = null;
     HttpURLConnection urlConnection = null;


     try {



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

      urlConnection = (HttpURLConnection) finalUrl.openConnection();

      urlConnection.setUseCaches(false); 




          urlConnection.connect();



    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            DocumentBuilder db = dbf.newDocumentBuilder();
            Document doc = db.parse(new    
             InputSource(urlConnection.getInputStream()));
            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;

                }//end for

            urlConnection.disconnect();



        }//end try











    catch (Exception e)
    {
        String[][] res;
     flag=false;

   Log.e(LOG_TAG, "CONNECTION ERROR  FUNDAMO SERVER NOT RESPONDING", e);













     public class AgAppTransAirTimeTopUp  extends Activity {





                btnTATsubmit.setOnClickListener(new OnClickListener()
        {
        public void onClick(View v)

        {


                                submitATTP();
             }

        }

                                        }); 



                protected void submitATTP() {

                       xmlResponse = AgAppHelperMethods.AgAppXMLParser("Axyz......");
                 if(!AgAppHelperMethods.flag)
                    {

    Toast.makeText(getApplicationContext(), "Invalid Input " ,     
             Toast.LENGTH_SHORT).show();

            }
    else {

 Intent j = new Intent(AgAppTransAirTimeTopUp.this, AgAppTransATTPResponse.class);
</code></pre>
