title: How to get remaining duration of downloading file
body: <pre><code>public class MainActivity extends AppCompatActivity {
  
  
  
  
      // button to show progress Dialog
      Button btnShowProgress;
  
      // progress dialog
      ProgressDialog proDaiog;
  
  
      //File url to download
      private static String url = "http://rvo/file/Ardu_Vid.mp4";
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
  
          // show progress bar button
          btnShowProgress = (Button) findViewById(R.id.button);
  
          btnShowProgress.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  new DownloadFile().execute(url);
                  //   running = true;
                  //   runTimer();
  
              }
          });
  
      } // end onCreate
  
      private class DownloadFile extends AsyncTask&lt;String, Integer, String&gt; {
  
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
  
              proDaiog = new ProgressDialog(MainActivity.this);
  
              //Set progress dialog title
              proDaiog.setTitle("Downloading...");
  
              //set progress dialog message
              proDaiog.setMessage("");
              proDaiog.setIndeterminate(false);
              proDaiog.setMax(100);
              proDaiog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
  
  
              proDaiog.show();
  
          }
  
  
          @Override
          protected String doInBackground(String... Url) {
              try {
                  URL url = new URL(Url[0]);
                  URLConnection connection = url.openConnection();
                  connection.connect();
  
                  //Detect File Length
                  int fileLength = connection.getContentLength();
  
                  //Locate Storage Location
                  String filePath = Environment.getExternalStorageDirectory().getPath();
  
                  //Downloading File
                  InputStream input = new BufferedInputStream(url.openStream());
  
                  //Save the Download File
                  OutputStream output = new FileOutputStream(filePath + "/" + "Ardu_Vid.mp4");
  
                  byte data[] = new byte[fileLength];
                  long total = 0;
                  int count;
                  int s = 1;
                  //  Long startTime = System.nanoTime();
                  //  Log.e("Time-",""+startTime);
  //                Long elapsedTime = System.nanoTime() - startTime;
                  int sec = 0;
  
                  while ((count = input.read(data)) != -1) {
  
                      long Start_Timee = System.currentTimeMillis();
  
                      //long seconds = TimeUnit.MILLISECONDS.toSeconds(Start_Timee);
  
  
                      total += count;
                      output.write(data, 0, count);
  
                      //publish the progress
                      publishProgress((int) (total * 100 / fileLength));
  
                  /************ Get Duration of Downloading ***************/
  
                      Long End_Timee = System.currentTimeMillis();
                      Log.e("Time_End", "" + End_Timee);
  
                      long seccc = (End_Timee - Start_Timee);
                      Log.e("estimate ",""+seccc);
  
                      int seconds = (int) (seccc / 1000) % 60 ;
                      int minutes = (int) ((seccc / (1000*60)) % 60);
                      Log.e("elapse",""+minutes+":"+seconds);
  
  
  
                  }// end while
  
                  //close connection
                  output.flush();
                  output.close();
                  input.close();
  
              } catch (Exception e) {
                  Log.e("Error", e.getMessage());
                  e.printStackTrace();
              }
  
              return null;
          }
  
          @Override
          protected void onProgressUpdate(Integer... progress) {
              super.onProgressUpdate(progress);
              proDaiog.setProgress(progress[0].intValue());
              Log.i("proDaiog.setProgress", "" + progress[0]);
          }
  
          @Override
          protected void onPostExecute(String s) {
              super.onPostExecute(s);
              proDaiog.dismiss();
          }
      } // end Asyc
  </code></pre>
  
  <p>I want to get Remaining duration of downloading File Means If you use Idm you was see left time during downloading  i want show same functionality in my app but i stuck on this functionality i completed whole app but i 'm stuck only Remaining  duration please help</p>