Problem in File Downloading from server in android application
<p>I am using this code of snippet to download mp4 files from server. Normally file get download properly, 
but sometime my downloading process stops downloading automatically. Progress bar stop incrementing. Is there any kernel process that stop download.   </p>

<pre><code>//+++++++++= FUnction Call ++++++++++++++++

DOWNLOAD_FILE_NAME = "demo.mp4";
grabURL("mp4 file server url");  

//+++++++++++++++++++++++++++++++++++++++++

public void grabURL(String url) {  

          new GrabURL().execute(url); 

    }
private class GrabURL extends AsyncTask&lt;String, Void, Void&gt; {  
                  private final HttpClient Client = new DefaultHttpClient();  
                  private String Content;  
                  private String Error = null;  
                  private ProgressDialog Dialog = new ProgressDialog(SlideShow.this);  

                  protected void onPreExecute() {  


                   showDialog(DIALOG_PROGRESS);
               mProgressDialog.setProgress(0);

                  }  

          protected Void doInBackground(String... url) {  
              int count;

              try {
                  URL url2 = new URL(url[0]);
                  URLConnection conexion = url2.openConnection();
                  conexion.setUseCaches(true);
                  conexion.connect();

                  // this will be useful so that you can show a tipical 0-100% progress bar
                  int lenghtOfFile = conexion.getContentLength();
                  mProgressDialog.setMax(lenghtOfFile);
                  // downlod the file
                  InputStream input = new BufferedInputStream(url2.openStream());
                  OutputStream output = new FileOutputStream(DOWNLOAD_FILE_NAME);

                  byte data[] = new byte[1024];

                  while ((count = input.read(data)) != -1) {

                      mProgressDialog.incrementProgressBy(data.length);
                          output.write(data, 0, count);
                  }

                  output.close();
                  input.close();
              } catch (Exception e) {}
              return null;
          }  
</code></pre>
