Hi All

In my Android app, I need to call a  non static java method from C/C++.
But i get a blunt crash when i do it using
GetMethodID/CallVoidMethod()1 methods.

I have done like this:

1. Register the method using GetMethodID() as follows (mine is  a cpp file):

       jmethodID xyz =  (env)->GetMethodID( cls, "showxyz", "()V");


2. And I call this method as follows:

     env->CallVoidMethod(cls, xyz);


3. In java, my showxyz() is defined this way(this basically enables a
button which was disabled)

void showxyz()
       {
               findViewById(R.id.btnPass).setEnabled(true);
       }

And this crashes.


But I have been using this method of calling Java funcs from C using a
set of  GetStaticMethodID/CallStaticVoidMethod()(for nonstatic
methods) and that works always.

But in this case, I have to call a non-static method and i get a crash.

Can anybody please tel me where I am going wrong. I know this is a
basic JNI knowledge. But I am left high and dry. Please do advise.

thanks
Latha

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