Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "NativeMethod.h"
- #include "legacy.h"
- #include <stdio.h>
- JNIEXPORT jint JNICALL Java_NativeMethod_calculateGreenTax(JNIEnv *env,
- jclass cls, jobject car) {
- jclass Car = (*env)->GetObjectClass(env, car);
- jfieldID id_category = (*env)->GetFieldID(env, Car, "category", "I");
- jint category = (*env)->GetIntField(env, car, id_category);
- jfieldID id_km = (*env)->GetFieldID(env, Car, "km", "D");
- jdouble km = (*env)->GetDoubleField(env, car, id_km);
- // jmethodID idCategory = (*env)->GetMethodID (env, Car, "getCategory", "()I");
- // int category = (*env)->CallIntMethod (env, car, idCategory);
- //
- // jmethodID idKm = (*env)->GetMethodID (env, Car, "getKm", "()D");
- // double km = (*env)->CallDoubleMethod (env, car, idKm);
- return calculate(category, km);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement