I want to develop file downloader app . which download list of file .when I add file to downloader list then its updating progress periodically. I close all activity and again I run the app then my app list all the current downloads with continuous progressbar
What should I do for that ?
I am using this async task for downloading File
class DownloadFileFromURL extends AsyncTask<String, String, String> {
            @Override
            protected void onPreExecute() {
                super.onPreExecute();
            }
            @Override
            protected String doInBackground(String... f_url) {
                int count;
                try {
                    URL url = new URL(f_url[0]);
                    URLConnection conection = url.openConnection();
                    conection.connect();
                    // getting file length
                    lenghtOfFile = conection.getContentLength();
                    // input stream to read file - with 8k buffer
                    InputStream input = new BufferedInputStream(
                            url.openStream(), 8192);
                    OutputStream output = null;
                    if (space_avaliable) {
                        File dir = new File(
                                Utill.saveFile(CustomGroupTabActivity.mTabHost
                                        .getContext()) + "/tocaonline");
                        if (!dir.exists()) {
                            dir.mkdirs();
                        }
                        // Output stream to write file
                        output = new FileOutputStream(
                                Utill.saveFile(CustomGroupTabActivity.mTabHost
                                        .getContext())
                                        + "/tocaonline/"
                                        + "test.mp3");
                        byte data[] = new byte[1024];
                        long total = 0;
                        while ((count = input.read(data)) != -1) {
                            total += count;
                            // publishing the progress....
                            // After this onProgressUpdate will be called
                            publishProgress(""
                                    + (int) ((total * 100) / lenghtOfFile));
                            // writing data to file
                            output.write(data, 0, count);
                        }
                        // flushing output
                        output.flush();
                    }
                    // closing streams
                    output.close();
                    input.close();
                } catch (Exception e) {
                    Log.e("Error: ", e.getMessage());
                }
                return null;
            }
            protected void onProgressUpdate(String... progress) {
                // setting progress percentage
                p_bar.setProgress(Integer.parseInt(progress[0]));
            }
            @SuppressWarnings("unchecked")
            @Override
            protected void onPostExecute(String file_url) {
            }
        }
And when I click on add to download button then I am adding dynamic view to the linear layout.
LinearLayout lytParent = (LinearLayout) findViewById(R.id.boxset_parentview);
        LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflater = LayoutInflater.from(CustomGroupTabActivity.mTabHost
                .getContext());
        View convertview = inflater.inflate(R.layout.raw_set_detail, null);
final ProgressBar p_bar = (ProgressBar) convertview
                .findViewById(R.id.rawsetdetails_sync_progress);
lytParent.addView(convertview);
It running well when my activity is active. but when I close all activity and again running this activity then I want to show actual downloading progress with active downloads.