This is the Java class i'm accessing through JNIEnv in my monodroid
application
package mypackage;
import android.util.Log;
public class JavaScriptInterface 
{
    public String submitAns = "";
    // The JNI in the original question uses a default constructor.
    // Either provide one explicitly or use the implicit one...
    public JavaScriptInterface() 
    {
    }   
    public String getSelctd()
    {
       return submitAns;
    }
}

I'm able to instantiate the class by the following statements:

Java.Lang.Object jclassWrp_;
IntPtr JavaScriptInterface_Class =
JNIEnv.FindClass("mypackage.JavaScriptInterface");
IntPtr JavaScriptInterface_ctor =
JNIEnv.GetMethodID(JavaScriptInterface_Class, "<init>", "()V");
//(Landroid/context/Context;)V
IntPtr jsInterfaceinstance_ = JNIEnv.NewObject(JavaScriptInterface_Class,
JavaScriptInterface_ctor);
jclassWrp_ = new Java.Lang.Object(jsInterfaceinstance_,
JniHandleOwnership.TransferGlobalRef);


But when i try to create the object to access the getSelctd() method:

IntPtr ipApid = JNIEnv.GetMethodID(jclassWrp_, "getSelctd",
"()Ljava/lang/String;");

It throws NoSuchMethodExist Exception... Please tell me whether i'm doing it
the right way and what i'm missing here...




--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Using-JNIEnv-Classes-tp5711303.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to