Bluetooth and RMS

Hello all. I would like to ask a question for a Bluetooth based program example in the WTK "BluetoothDemo" application.

The Host is sharing his images via Bluetooth. Image are read through the local files an InputStream.

Is the client possible to store the images in a RecordStore from the Host?

Because in the program the client only views the images but they are not stored

somewhere.

Is it possible to store them in the RMS so that if there is no bluetooth connection between Host-Client, the client can view them afterwards?

thank u in advance

[591 byte] By [Sectora] at [2007-11-27 10:36:42]
# 1

If your question is : How to convert an Image to an array of bytes?

read this

http://forum.java.sun.com/thread.jspa?threadID=5194977&tstart=0

etaa at 2007-7-28 18:43:07 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2

Thanks for the reply, but is it possible to store the image in RMS via Bluetooth? :)

The Client is able to view the image. From that point i want to save it in RMS for a future use, if a connection between the host-client is not possible.

Any ideas or example?

Thank u again

Sectora at 2007-7-28 18:43:07 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3

I think it is possible.

I didn't experienced it yet. but you will have a connection that you can send bytes using that.

then you will be able to send your image bytes.

and Itold you how to convert image to byte array.

etaa at 2007-7-28 18:43:07 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4

thank u my friend. It was kinda hard for me but it worked.

I would like to extend my questiong, how to load back the images from rms.

How can we keep track the images names and save it in a List let's say..?

So from RMS i can call the selectedIndex of the List and load the imgs.

Sectora at 2007-7-28 18:43:07 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 5

Hi Sector,

First of all I like to tell u that if Eta has solved ur query correctly then u should award the dukes to Eta 'cuz thats why u assigned the dukes to the thread isn't it!!

And to ur next query, if u have the image as an byte array stored in the RMS correctly, then u can get the Images easily from the RMS. See the Java doc for retrieving data from RMS and creating an Image from a byte array.

Well to have the name of the images along with Images, u can create a data structure of ur own, then get the content as byte array from it and save in the RMS.

find_suvro@SDNa at 2007-7-28 18:43:07 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 6

Yes im sorry Eta totaly forgot. I have assigned u my duke stars :) thanks for your help. I have succesfully stored and loaded images from RMS.

Survo: do u have any code example for saving the names? Sorry for my "noobitity".

Can RMS store also any type of data eg. text, audio?

thanks again

Sectora at 2007-7-28 18:43:07 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 7

an rms is a storage that you can access it's records using IDs.

there exists no index or something else.

but there are to powerfull options that you can use.

there is an interface called RecordEnumeration.

record enumeration objects can be assigned useing RecordStore.enumerate record non static function.

the enumerateRecord function has three parameters that the first twos are RecordFilter and RecordComparator.

by aid of record filter you can filter your desired records and by using record comparator you can receive records in your desired order through nextRecord method of RecordEnumeration object.

these are the only but more powerfull devices that you can use.

and this link will be a very good one for you. specially for your question "how too store names in rms"

ouh I forgot the link

http://developers.sun.com/mobility/midp/articles/persist/

go have fun!!!

eta

Message was edited by:

eta

etaa at 2007-7-28 18:43:07 > top of Java-index,Java Mobility Forums,Java ME Technologies...