Re: [android-developers] progressBar for percentage of file-uploaded

2012-02-08 Thread TreKing
On Tue, Feb 7, 2012 at 4:59 PM, Farhan Tariq  wrote:

> I need help/suggestions with how do, if i can, get an output stream, if
> that would help, from the HttpClient and get the number of bytes sent?


http://android-developers.blogspot.com/2011/09/androids-http-clients.html
http://developer.android.com/reference/java/net/URLConnection.html#getOutputStream()

http://developer.android.com/reference/java/io/OutputStream.html#write(byte[],
int, int)

-
TreKing  - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] progressBar for percentage of file-uploaded

2012-02-07 Thread Farhan Tariq
Hi guys,

I have written a piece of code in an application that uploads a file to a
location, if provided with path of a file. What i am missing is a way to
show the percentage of file uploaded. I am using apache's http library for
this purpose (found it on the internet). The relevant code is here:

final File file = new
File(filePathToUpload);
final HttpClient client = new
DefaultHttpClient();
...
...
String postURL= Constants.BASE_URL;
HttpPost post = new HttpPost(postURL);
FileBody bin = new FileBody(file);
MultipartEntity reqEntity = new
MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
reqEntity.addPart("myFile", bin);
post.setEntity(reqEntity);
client.execute(post);

I need help/suggestions with how do, if i can, get an output stream, if
that would help, from the HttpClient and get the number of bytes sent? I
need to show the percentages on my progressBar...
Is it even possible with httpClient?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en