Wednesday, June 30, 2010

[android-developers] Re: How to send a photo over Bluetooth

Hi,

Thank you, it seems that is exactly what I wanted. I have not tested
it but apparently it works. By the way, I saw there is not an specific
function defined by the FileInputStream class to know the number of
bytes of the picture; do you know how can I get this value. I mean, I
am using this code:

FileInputStream f;
byte[] message_byte_array = new byte[512];

Log.d(TAG, "Sending photo");

try {
f = new FileInputStream("/sdcard/DCIM/Camera/prueba.jpg");
int i = f.read(message_byte_array);

....

f.close();
}


Read returns the number of bytes read, but there is any way to know
this number before to create the byte[] array accordingly??


Once again thanks for your time, Gorka.


On 29 jun, 13:36, Naoto <naoto.kan...@gmail.com> wrote:
> Hi,
>
> I happened to have written something similar just recently.  How about
> just opening the file with FileInputStream and use read() to read out
> the byte[]?  On the receiver end, you just write() with
> FileOutputStream.  Or did you just want tosendthe pixel data from
> memory to memory?
>
> I hope this helps.
>
> On 6月29日, 午後5:55, Gorka <gork...@gmail.com> wrote:
>
> > I am sorry that I forgot to say that the photos are in JPEG format
>
> > On 29 jun, 09:26, Gorka <gork...@gmail.com> wrote:
>
> > > Hello,
>
> > > I am trying tosendaphotofrom my Android device to a laptop via
> > >Bluetooth. Right now I have a gallery on the screen where the photos
> > > are depicted. What I want to do is to click aphotoand directlysend
> > > it to the laptop. All theBluetoothstuff works fine but what I don´t
> > > know how to do is to get the byte[] that conforms the picture that
> > > should be sent. Maybe that is not the way is supposed to be done, so
> > > please it would help if someone gives me some suggestions about how to
> > > proceed. I just need some guidelines, later I will investigate how to
> > > code everything. Once theBluetoothmessages reach the laptop is there
> > > something to do to "rebuild" the picture??
>
> > > And secondly, by now I am copying the files to the drawable file of my
> > > project. Is it possible to directly get them from the folder where the
> > > picturea I take are stored??
>
> > > Thank you very much for your help. Gorka
>
>

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate