The serialization can be any kind you want or are able to implement.

It can be Java Serialization, sure. But doesn't have to be.

I am not at all familiar with Jena, so this is sort of generally speaking....

...for relatively simple objects with few references to others, which also belong to one of a few known classes, you could serialize "by hand" to your own format. Perhaps even a string (you'd then be able to use string methods in ContentValues / Cursor).

...if these objects are large, can belong to a whole lot of different subclasses, and are only useful when connected to a whole bunch of others (forming an in-memory graph), then you might have to rethink your approach, so you don't have to shuffle a lot of data around.

Perhaps define a higher-level interface that supports the operations you'd be doing on a Statement / Resource if you had one of them. Implement it using a Binder or Intents, or a ContentProvider (URI matching is very flexible). That'll keep the in-memory object graph inside one process, with others querying just for the needed operations.

Just my RUB 0,02.

-- Kostya

12.08.2010 17:47, Natanael Arndt пишет:
Thank you,
it should be Jena-Statements and Resources, which I want to provide.

Do the Objects need to implement Serializable for your first way?

Natanael

Am 12.08.2010 13:42, schrieb Kostya Vasilyev:
Natanael,

It just really depends on what this data structure is, how big it is,
and how it's used.

One of the primitive types supposed by Cursor is Blob, so you have:

byte[] getBlob(int columnIndex)

And a matching method in ContentValues:

void put(String key, byte[] value)

To convert between your data structure and a byte array you can use Java
serialization, or any other format.

Another way is to break down your data structure into individual pieces
and store and retrieve them individually. Define various ContentProvider
URIs to access different parts of the data structure.

-- Kostya

12.08.2010 15:12, Natanael Arndt пишет:
Hello,
I have a custom class, which represents my data-structure. This custom
class is in a normal Java-library, which is included in both projects.
I have one Project with a ContentProvider which provides this data to
Activities of other Projects.
And an other Project with an Activity, where I want to handle this
data in objects of this custom class.

How can I get this data to the Activity? The Cursor [1] only supports
primitive Types.

[1] http://developer.android.com/reference/android/database/Cursor.html







--
Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

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