Skip to content Skip to sidebar Skip to footer

I Want In Download Xml File For Parsing?

I am using using following code to download the file form receptive source private InputStream downloadUrl(String urlString) throws IOException { URL url = new URL(urlString)

Solution 1:

try the following:

      URL url = new URL(urlString);
      HttpURLConnection conn = (HttpURLConnection)url.openConnection();
      conn.setRequestMethod("GET");
      conn.setDoInput(true);
      conn.setReadTimeout(10000);
      conn.setConnectTimeout(15000);

      Log.v("Start Query", "Stream");          
      conn.connect();
      Log.v("End Query", "Stream");
      //read the result from the server
      BufferedReader rdr  = new BufferedReader(new InputStreamReader(conn.getInputStream()));
      StringBuilder sbr = new StringBuilder();

      while ((line = rdr.readLine()) != null)
      {
          sbr.append(line + '\n');
      }

      Log.v(sbr.toString(), "Stream");

Post a Comment for "I Want In Download Xml File For Parsing?"