请问uni-app本地离线打包后,如何调用自定义JAVA类中方法?
一、在H5+ 中是可以调用成功的,代码如下:
1、网页中:
function plusReady(){
var NjsHello = plus.android.importClass("com.example.H5PlusPlugin.HelloWorld");
alert(NjsHello.BIRTHDAY);
var hello = new NjsHello();
hello.setUsername('hello h5+!');
var wv = plus.android.currentWebview();
hello.print(0,0,0,0,wv);
var sname = hello.getUsername();
console.log( "NjsHello Final's value: "+sname );
}
2、JAVA代码:
public class HelloWorld {
printer mPrinter = new printer();
public static final String BIRTHDAY="2007-03-16";
public String username ="2007-03-16";
public String getUsername() {
try {
int result = mPrinter.Open(