When you get the identifier of the constructor method, you just need to specify which one you want. You are currently probably doing something like:
constructor = (*env)->GetMethodID(env, cls, "<init>", "()V");
object = (*env)->NewObject(env, cls, constructor);
Instead, you want to specify the type of the argument when used GetMethodIDand pass it when called NewObject.
constructor = (*env)->GetMethodID(env, cls, "<init>", "(Landroid/content/Context;)V");
object = (*env)->NewObject(env, cls, constructor, context);
source
share