简体   繁体   English

如何使用 Z3AB8B307E489AF2A6C91837B 获取从 java class 到本机脚本 jar 文件的变量数据

[英]How to get variable data passed from java class to native script jar file using javaScript

This is how I pass data这就是我传递数据的方式

SharedPreferences pref = getApplicationContext().getSharedPreferences("FingerPrint", 0);
                            SharedPreferences.Editor editor = pref.edit();
                            editor.putString("fingerImage", encodedWsq);
                            editor.apply();

And I want to access "fingerImage" data to my nativescript project, that is java files are exported to jar file.我想将“fingerImage”数据访问到我的 nativescript 项目,即 java 文件导出到 jar 文件。

Perhaps you could directly use the application-settings NativeScript module (which is using SharedPrefferences behind the scenes) to set & get the values.也许您可以直接使用application-settings NativeScript 模块(在幕后使用 SharedPreferences)来设置和获取值。

TypeScript example TypeScript 示例

import { setString, getString } from "tns-core-modules/application-settings";
setString("fingerImage", encodedWsq);
const myString = getString("fingerImage");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM