Reputation: 961
I created an app in android that enables the user to compress/decompress a file. I need to show a ProgressDialog
to show the progress while compressing/decompressing a file. I know how to do the ProgressDialog
, but I do not know how will I display the current progress or what will I put inside the publishProgress(code here)
. My problem is similar to this one:
Download a file with Android, and showing the progress in a ProgressDialog
But the link refers for downloading a file but what I need is for compressing/decompressing file. Thanks!
Upvotes: 1
Views: 764
Reputation: 2029
Use a custom AsyncTask
class. aka private class MySync extends AsyncTask {
onPreExecute()
, set up the ProgressDialog
, set your max value setMax()
doInBackGround(...)
, compress/decompress, set the current progress setProgress()
onPostExecute()
, end the ProgressDialog (.dismiss())
I would need to see your code to determine a way to quantify your progress.
Upvotes: 1