JavaFXPorts(Gluon插件)在Android上保存文件 [英] JavaFXPorts(Gluon Plugin) Saving Files on Android

查看:133
本文介绍了JavaFXPorts(Gluon插件)在Android上保存文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用JavaFxPorts在Android上保存文件时遇到问题。



我发现链接



它找不到界面,我也无法使用它。



我的目标是使用JavaFxports在Android上保存文件。



谢谢

解决方案

如果您尝试在Android文件夹中添加一些代码,请确保在主项目中正确添加 GluonPlatform 类。您可以查看Gluon示例存储库中的GoNative 示例,了解如何执行此操作。



但是要将文件保存在移动设备上应用程序的本地文件夹中,您可以使用Gluon的 Charm-Down 开源库。



它包含几种平台特定服务的通用API。



您只需要将它添加到您的依赖项中 build.gradle 脚本:

  ext.CHARM_DOWN_VERSION =1.0。 0

依赖项{
compilecom.gluonhq:charm-down-common:$ CHARM_DOWN_VERSION
desktopRuntimecom.gluonhq:charm-down-desktop:$ CHARM_DOWN_VERSION
androidRuntimecom.gluonhq:charm-down-android:$ CHARM_DOWN_VERSION
iosRuntimecom.gluonhq:charm-down-ios:$ CHARM_DOWN_VERSION
}

保存并重建项目(因此包含了这些依赖项),现在在主项目中,您可以请求本地路径您的设备和访问该文件:

  public File getFile(){
File path = PlatformFactory.getPlatform( ).getPrivateStorage();
返回新文件(path,config.xml);
}


I have a problem to save Files on Android with JavaFxPorts.

I've found that link here, but it doesn't work for me.

It doesn't found the Interface, and I can't use it.

My goal is to save a file on Android with JavaFxports.

Thanks

解决方案

If you are trying to add some code in the Android folder, make sure you add correctly the GluonPlatform class in the main project. You can have a look at the GoNative sample in Gluon's sample repository, for finding out how to do it.

But to save a file in the app's local folder on your mobile device, you can use Gluon's Charm-Down open source library.

It contains common API for several platform specific services.

You just need to add it to your dependencies on the build.gradle script:

ext.CHARM_DOWN_VERSION = "1.0.0"

dependencies {
    compile "com.gluonhq:charm-down-common:$CHARM_DOWN_VERSION"
    desktopRuntime "com.gluonhq:charm-down-desktop:$CHARM_DOWN_VERSION"
    androidRuntime "com.gluonhq:charm-down-android:$CHARM_DOWN_VERSION"
    iosRuntime "com.gluonhq:charm-down-ios:$CHARM_DOWN_VERSION"
}

Save, and rebuild your project (so those dependencies are included), and now on your main project you can ask for the local path on your device, and access to the file:

public File getFile() {
    File path = PlatformFactory.getPlatform().getPrivateStorage();
    return new File(path, "config.xml");
}

这篇关于JavaFXPorts(Gluon插件)在Android上保存文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆