I upload photo to the server via the default HttpClient in Android SDK. I want to show progress in the user interface, is there a way to find out how much has been uploaded? Is it possible with HttpUrlConnection?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For me HTTPClient didn’t work. The bytes where buffered in parts and sent as total after the flush call. What worked was to sent it on socket level.
You can use the HttpMultipartClient for this (updated link on 30-10-2011):
http://code.google.com/p/rainbowlibs/source/browse/android/trunk/rainbowlibs/src/it/rainbowbreeze/libs/data/HttpMultipartClient.java?spec=svn94&r=94
Specify the amount of bytes for each part and update the progressbar in the while loop:
while (( line = reader.readLine()) != null && !headersEnd)
Call the HttpMultipartClient as folow:
At the server side use:
I used this for Bluppr Postcards, worked like a charm. If you need more info let me know.