I don't pass any STL structures across JNI, I pack/unpack just the
data I need in to basic types or arrays of basic types, doing my own
simple streaming as required.

My application is a board game with the next move calculator in C++
and the UI (and game state) in Java, so there is not much to transfer
between the two layers.

If you have a lot of state you need to pass back and forth between C++
and Java I suggest you have a look at NativeActivity (I am just
starting this myself - so I can be much help here).  It looks like it
by subclassing the Java NativeActivity class it should be possible to
keep my entire engine (and it's state) in C++ and pass just the UI
events across the JNI interface.  I have not tried this yet - I can
feel a test project coming on.

On Jun 16, 10:06 pm, "[email protected]" <[email protected]>
wrote:
> hey Richard, thanks for helping ... in fact, i have installed SDK-NDK,
> read the CPLUSPLUS-SUPPORT.html doc,  and preparing to compile my C++
> STL stuff, but what i really am afraid is of JNI. There are interfaces
> depending of the filed's types, and i dont realize how to pass STL
> structures or pointers to them. I wonder if you have a kind of hello-
> jni example which you can share in this thread ?
>
> kriss, i agree with you, but development time is a  real constraint :-
> (
>
> On Jun 16, 3:25 pm, RichardC <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I have a big "lump" of STL code that is building sucessfully using the
> > latest release of the Android-ndk (r5c).  It just need a few tweaks.
> > It is called from Java via JNI as needed.
>
> > I sugguest you download the 
> > NDK:http://developer.android.com/sdk/ndk/index.html
>
> > and read the docs specifically "CPLUSPLUS-SUPPORT.html"
>
> > If you have any questions I will try and help.
>
> > On Jun 16, 4:55 pm, "[email protected]" <[email protected]>
> > wrote:
>
> > > hi guys,
> > > I would like to migrate a c/c++ (linux fedora 14) application to
> > > android 2.2.
> > > Because this will be my first migration, i have some questions about
> > > the procedure:
>
> > > 1. considering it has some STL stuff, i wonder if it will work. I
> > > specially use vector, set, map and algoritms (set_union,
> > > set_intersection, set_difference).
>
> > > 2. as i understand i have to write -first- a Java-JNI application
> > > which declares and interface my c functions and c++ methods. Those
> > > methods willl be included into one (or many) shared libraries ... is
> > > it ok ? ... may somebody advise me a good JNI tutorial ? ... i don
> > > like the ones i've found :-(
>
> > > 3- once ready, i must use the NDK toolset in order to generate the
> > > android application ... hopefully i will works..
>
> > > I am worried because the NDK info says to have a "A Minimal set of
> > > headers for C++ support" ... and i wonder if  STL works or not ...
> > > but, NDK r5 - android - suposse to also hav support for STLport ...
> > > does any body has the hello-jni file modifyied for STL suppport ?
>
> > > NDK Doc also says that "Applications that use native activities must
> > > be run on Android 2.3 (API Level 9) or later", but as i understand, i
> > > will also needs JNI .. may somebody make some comments about it ?
>
> > > finally, may somebody share me a JNI example in order to pass some STL
> > > functions between java and c++ ?
>
> > > comments are wellcome.
>
> > > regards, thanks in advance
>
> > > hector

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to