2009/6/22 subram <[email protected]>

>
> Hi there
>    I am trying to invoke a c project in android for that i installed
> android source code in ubuntu and generated an shared library of my c
> project using the android source code,
> Now i have to invoke my shared library inside android SDK and make it
> to run my c project in that shared library,kindly suggest what to do
> next.

Have a javaclass,

U need to have a JNI layer in between so that java can call ur  c functions.

So wrape ur c fiels with a jni layer, build another shared library.
use System.loadLibrary("libraryname");
to load that,
and then in java u can call these methods.

>
>
> On Jun 16, 9:20 pm, Roman <[email protected]> wrote:
> > Hi Subram,
> >
> > I would try to spend some time in understand JNI. JNI calls are very
> > costly also if your native code might be pretty fast. If you use JNI
> > in the wrong way you program might run very flaky.
> >
> > Find information about JNI on
> >
> > http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jni....
> >
> > You have to know that you have to write JAVA and C/C++ code to be able
> > to use JNI functionality.
> > On the Java level you are calling the wrapper methods which you have
> > defined on the native level. The method signature format might be a
> > little bit confusing but the usage is straight forward.
> >
> > Furthermore check out the following Android code which uses JNI
> >
> > /external/webkit/perf
> >
> > You find in the
> >
> >  main.cpp how to setup JNI on Java level
> >
> > and in MyJavaVM.cpp how to write some wrapper methods which are
> > calling the native code. Make sure that you do on the native level
> > type checks on whatever you are passing down.
> >
> > Furthermore try to think about garbage collection and we it should
> > take place!
> >
> > --
> > Roman Baumgaertner
> > Sr. SW Engineer-OSDC
> > ·T· · ·Mobile· stick together
> > The views, opinions and statements in this email are those of the
> > author solely in their individual capacity, and do not necessarily
> > represent those of T-Mobile USA, Inc.
> >
> > On Jun 15, 10:18 pm, subram <[email protected]> wrote:
> >
> > > Hi There
> > >     How to write a simple JNI that will print a message in the android
> > > screen/do the operation specified in the shared library
> >
> > > Thanks in advance
> > > Subram
> > > On Jun 15, 3:42 pm, arunjith g <[email protected]> wrote:
> >
> > > > you will have to use JNI methods to invoke a call in shared library
> > > > what u do is
> >
> > > > 1. Create a java class includes myfunC()
> > > > 2. Create a jni header file from this class
> > > > 3. It will have a jni_blahblah_myfunc call
> > > > 4. create a c/c++ file giving implementation to this function by
> calling ur
> > > > required shared library function
> >
> > > > On Mon, Jun 15, 2009 at 4:08 PM, subram <[email protected]> wrote:
> >
> > > > > Hi there
> > > > >     I am having an shared library named librecord.so, i have to
> > > > > invoke this library inside the android project and make it to call
> by
> > > > > the sdk,if any one came across with thisinvokingkindly suggest me
> >
> > > > > Thanks in advance
> > > > > Subram
> >
>


-- 
Shine bright,
(: Naveen Krishna Ch :)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to