-2

I want to make a progress bar for my android application on the basis of percentage ,like percentage starts with 100 and decreases to 0 . So that I want to move my progress bar from 100 to 0 percentage ,decrease it from the max to minimum. can anybody help me?

Amad Zafar
  • 13
  • 6
  • Using a progressbar with a decreasing percentage does not make sense. The word 'progress' indicates something is increasing. Next to that, have you done any research? – Leon Joosse Jul 05 '13 at 10:09
  • no .well I have seen some android applications using bars like that. So i am directly asking here to save my time :P – Amad Zafar Jul 05 '13 at 10:12
  • Well, we're not here to do your work. If you ask a question on this site, we expect you to do some research. And if you can not find an answer, than it is the right time to ask a question on this site. – Leon Joosse Jul 05 '13 at 10:16
  • thank you for your good response :) #peace – Amad Zafar Jul 05 '13 at 10:18

1 Answers1

1

Use AsyncTask and show the download progress in a dialog

Use publishProgress() in AsyncTask to show

You can refer to this answer https://stackoverflow.com/a/3028660/1441666

Write this in doInBackground

           while ((count = input.read(data)) != -1) {
                total += count;
                // publishing the progress....
                publishProgress((int) (total * 100 / fileLength));
                output.write(data, 0, count);
            }

And then

@Override
protected void onProgressUpdate(Integer... progress) {
    super.onProgressUpdate(progress);
    mProgressDialog.setProgress(progress[0]);
}
Community
  • 1
  • 1
Nirali
  • 13,571
  • 6
  • 40
  • 53