Set progressbar to KB and MB instead of % for android download manager
I'm trying to download an image from url and I need to display the size of the file and the progress of the file downloading. This is what I have. int bytes_downloaded = cursor.getInt(cursor .getColumnIndex(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR)); int bytes_total = cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES)); final int dl_progress = (int) ((bytes_downloaded * 100l) / bytes_total); runOnUiThread(new Runnable() { @Override public void run() { getFileSize(fileSizeInKB); mProgressDialog.setProgress((int) dl_progress); } }); As of now its showing %(ie..10