Hello Mark, You know..do you cover this in your book? I don't recall seeing
an example of this.

Anyway, it's a POST method to a Java/Jersey rest resource. I assumed I would
have to some how set the type to multipart/form-data like a browser does for
uploading files.

I am using your book in fact to work on a simple camera app, that takes a
picture and submits it to a rest service. The picture gets taken, I have the
byte[] jpeg data in the handler. I want to send that to the rest service so
it can be stored there.

I am making two rest calls tho. The first is to send some data (a dialog
will pop up allowing the user to enter some info..namely some comments).
I'll send that comments along with gps location info to the first rest call.
It will create a new entry in a DB and the response will be the id of that
entry. I will then make a rest call using that id to a different path to
submit the byte[] image data to.

I have the other rest call working fine, just need to figure out how best to
send the picture data. But, to be fair.. if there is an approach that sends
any binary data, such as files as well as pictures, that is fine too.

I've seen some various examples, where using FileBody and Base64 encoding
the byte[] and such.. figured there would probably be a better/faster way
without using Base64 to send the byte[] directly.

Thanks for any help you can provide.


On Sat, Jan 15, 2011 at 3:42 PM, Mark Murphy <mmur...@commonsware.com>wrote:

> You are going to need to be a bit more specific. Is this HTTP PUT?
> HTTP POST with chunked encoding? Something else?
>
> BTW, HttpClient has its own site:
>
> http://hc.apache.org/httpcomponents-client-ga/index.html
>
> On Sat, Jan 15, 2011 at 6:22 PM, Kevin Duffey <andjar...@gmail.com> wrote:
> > Hi,
> >
> > I have searched a bit on this forum and google for a good example of
> sending
> > a picture image to a service from android. HttpClient seems to be the
> most
> > logical way, but so far I haven't been able to find any solid example
> that
> > shows how to send a picture (or any binary file for that matter) to a
> > service, in my case a REST service. Does anyone have a snippet of code
> they
> > can paste that works for them in android 1.6, 2.0 or 2.1?
> >
> > Thank you.
> >
> > --
> > 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<android-developers%2bunsubscr...@googlegroups.com>
> > For more options, visit this group at
> > http://groups.google.com/group/android-developers?hl=en
>
>
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android App Developer Books: http://commonsware.com/books
>
> --
> 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<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
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

Reply via email to