3dphotoshoot

diff src/android/amain.c @ 2:cf5964db7ff3

finally jni calls fucking work
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 15 May 2015 02:06:26 +0300
parents 7eb73ce46dd0
children 38377f54527a
line diff
     1.1 --- a/src/android/amain.c	Thu May 14 23:46:56 2015 +0300
     1.2 +++ b/src/android/amain.c	Fri May 15 02:06:26 2015 +0300
     1.3 @@ -32,7 +32,9 @@
     1.4  	jstring jstr;
     1.5  	int res;
     1.6  
     1.7 -	if(!(foo_id = (*jni)->GetStaticMethodID(jni, activity_class, "foo", "(Ljava/lang/String;I)V"))) {
     1.8 +	printf("call_foo() [activity_class=%p]\n", (void*)activity_class);
     1.9 +
    1.10 +	if(!(foo_id = (*jni)->GetStaticMethodID(jni, activity_class, "foo", "(Ljava/lang/String;I)I"))) {
    1.11  		fprintf(stderr, "static method foo not found\n");
    1.12  		return -1;
    1.13  	}
    1.14 @@ -59,7 +61,7 @@
    1.15  		fprintf(stderr, "failed to attach native thread to Java VM\n");
    1.16  		exit(1);
    1.17  	}
    1.18 -	activity_class = app->activity_class;
    1.19 +	activity_class = (*jni)->GetObjectClass(jni, app->activity->clazz);
    1.20  
    1.21  	printf("JNI call returned: %d\n", call_foo("testing C->java jni calls", 42));
    1.22  
    1.23 @@ -288,3 +290,10 @@
    1.24  	dpy = 0;
    1.25  }
    1.26  
    1.27 +
    1.28 +/*
    1.29 +static jclass get_java_class(const char *name)
    1.30 +{
    1.31 +	jobject native
    1.32 +}
    1.33 +*/