From 7bcef048f6a089f4f73fce9a0d8c65e69e35b11d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E5=BA=86=E6=B3=89?= Date: Wed, 17 Jul 2024 12:06:29 +0800 Subject: [PATCH] Update uts-for-android.md --- docs/plugin/uts-for-android.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/plugin/uts-for-android.md b/docs/plugin/uts-for-android.md index 7982efa7..820e1cf7 100644 --- a/docs/plugin/uts-for-android.md +++ b/docs/plugin/uts-for-android.md @@ -976,6 +976,17 @@ export function request(options : RequestOptions) : RequestTask { } ``` +### 6.7 获取原生Class 对象 + +可以使用下面的代码获取指定class对象 +```kotlin +// 根据 类名 获取 class +let getClassByName = Class.forName("io.dcloud.uts.UTSJSONObject") +console.log(getClassByName); +// 根据 实例 获取 class +let getClassByInstance = UTSAndroid.getJavaClass(UTSAndroid.getUniActivity()!) +console.log(getClassByInstance); +``` ## 7 已知待解决问题(持续更新) -- GitLab