Skip to content Skip to sidebar Skip to footer

How Do I Monitor The Progress Of Urlconnection.getinputstream() In Android Where Javax.swing.progressmonitorinputstream() Is Unavailable?

I am uploading an image to a server. URLConnection connection; /* set up the connection parameters */ And finally, upload the file to the server via, connection.getInputStream();

Solution 1:

Try to wrap your uploading process into AsyncTask. So, you'll have uploading in doInBackground(), where you can upload your image "by parts" (actually, with some buffer), and after each portion is downloaded call publishProgress(). In onProgressUpdate() method you have ability to update your ui with the new progress state. You can update your progress bar, or set new percent value to TextView - do what you want.


Post a Comment for "How Do I Monitor The Progress Of Urlconnection.getinputstream() In Android Where Javax.swing.progressmonitorinputstream() Is Unavailable?"