Int Conversion
There is a function in Java, that calls a native function with string argument, like
setContentView("Hello World!");
and it works perfectly.
Now repeat the same thing with integer:
Java code: setContentView(2130903040);
Native code:
And instead of number, id is some strange object (see screenshot).7 Replies
What is the full signature of the native function?
Also, please clarify which version of CheerpJ you are using. Is still the stable 3.0?
Hello! Thanks for your answer,
Using
<script src="https://cjrtnc.leaningtech.com/3.0/cj3loader.js"></script>
I don't really know what is a "signature" of the function, did you mean this?
public static native void setContentView(int id);
Sorry, found the error!static
Yeah, that's the problem
Static was not required here
After removing it, got right int :)
You can use static too, but you need to be consistent. Without
static
there is an extra this
argument first
I think that the actual problem is that your .class or .jar file was not updated after changing the .java file. So he method was not actually static and you were observing the this
objectYeah, right,
.jar is compiled with different library
Than the actual library that is used
I'm just,
Running .apk files
Extracting .jar from apk's classes.dex
That is already compiled by android studio