Skip to content

Commit

Permalink
Merge pull request #2 from sergey-miryanov/master
Browse files Browse the repository at this point in the history
Allow to pass haxe string as java Object to JNI
  • Loading branch information
jgranick committed Jan 2, 2014
2 parents 65e7b0b + 94d58bf commit 246b023
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;


public class Extension {
Expand All @@ -16,6 +17,7 @@ public class Extension {
public static Handler callbackHandler;
public static Activity mainActivity;
public static Context mainContext;
public static View mainView;


/**
Expand Down
8 changes: 7 additions & 1 deletion project/src/platform/android/JNI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,12 @@ bool HaxeToJNI(JNIEnv *inEnv, value inValue, JNIType inType, jvalue &out)
jobject obj = 0;
if (!AbstractToJObject(inValue,obj))
{
if (val_is_string(inValue))
{
out.l = inEnv->NewStringUTF(val_string(inValue));
return true;
}

ELOG("HaxeToJNI : jniObject not an object %p", inValue);
return false;
}
Expand Down Expand Up @@ -1113,7 +1119,7 @@ struct JNIMethod : public lime::Object
result = alloc_int(env->CallShortMethodA(inObject, mMethod, jargs));
break;
case jniInt:
result = alloc_int(env->CallIntMethodA(mClass, mMethod, jargs));
result = alloc_int(env->CallIntMethodA(inObject, mMethod, jargs));
break;
case jniLong:
result = alloc_int(env->CallLongMethodA(inObject, mMethod, jargs));
Expand Down

0 comments on commit 246b023

Please sign in to comment.