android - Horizontal ProgressBar increment with percentage -


i have written program in android downloading web server have used json , http request program working properly... want show progress bar percentage depending upon things downloading. query how increment progress bar in percentage depending upon things downloaded , pending. know how calculate percentage how know how downloading pending server.

how downloading pending server.

you have implement range request in application.

you may use this reference if using chunks. otherwise, simple downloads

        urlconnection cxn = url.openconnection();         cxn.connect();         int lenghtbytes = cxn.getcontentlength();  

how increment progress bar

use publishprogress() in case of asynctask

   publishprogress((int)(bytesdownloaded * 100 / lenghtbytes)); 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -