From 98ed0cf8abddd6d393493de2504bd80272996842 Mon Sep 17 00:00:00 2001 From: duqingquan Date: Sat, 2 Nov 2024 18:11:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20java=20=E6=B7=B7=E7=BC=96?= =?UTF-8?q?=E8=B0=83=E7=94=A8console.log=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../uts-syntaxcase/utssdk/app-android/JavaUser.java | 8 ++++++-- uni_modules/uts-syntaxcase/utssdk/index.uts | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/uni_modules/uts-syntaxcase/utssdk/app-android/JavaUser.java b/uni_modules/uts-syntaxcase/utssdk/app-android/JavaUser.java index 0b321dd..35ce118 100644 --- a/uni_modules/uts-syntaxcase/utssdk/app-android/JavaUser.java +++ b/uni_modules/uts-syntaxcase/utssdk/app-android/JavaUser.java @@ -1,5 +1,7 @@ package uts.sdk.modules.utsSyntaxcase; +import io.dcloud.uts.console; + public class JavaUser { public String name; @@ -11,8 +13,10 @@ public class JavaUser { } public String toString() { - return "Name: " + name + ", Age: " + age; + String ret = "Name: " + name + ", Age: " + age; + console.log(ret); + return ret; } - + } diff --git a/uni_modules/uts-syntaxcase/utssdk/index.uts b/uni_modules/uts-syntaxcase/utssdk/index.uts index 19342ab..15aca88 100644 --- a/uni_modules/uts-syntaxcase/utssdk/index.uts +++ b/uni_modules/uts-syntaxcase/utssdk/index.uts @@ -267,9 +267,11 @@ export function callKotlinMethodGetInfo():String { } export function callJavaMethodGetInfo():String { - return new JavaUser("jack",12).name + return new JavaUser("jack",12).toString() } + + export function callKotlinCallbackUTS(callback: (res: string) => void) { NativeCode.kotlinCallbackUTS(function(res:string){ console.log(res) -- GitLab