If I remember rightly, the gallery returns you a content uri
so you'll want to do something like: getContentResolver
().openInputStream(uri)

On Nov 17, 5:53 am, Abhi <abhishek.r.sha...@gmail.com> wrote:
> Hi Dianne,
>
> I am trying to do the following.
>
> I have an Image viewer where in the user picks an Image from within
> the gallery. The uri to that selected Image is available to me. Now, I
> want to use this URI information and send it as a file over a socket
> using FileInputStream. Is this a valid syntax to perform the above
> action?
>
>       FileInputStream fis = new FileInputStream(uri.getPath()); //
> Here uri is the URI of the selected Image
>       byte[] buffer = new byte[fis.available()];
>       fis.read(buffer);
>
>       ObjectOutputStream oos = new ObjectOutputStream
> (socket.getOutputStream());
>       oos.writeObject(buffer);
>
> Please help me to move forward.
>
> Thanks,
>
> Abhi

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