我怎么可以编辑文本文件的资产文件夹中的android [英] how can i edit the text files in assets folder in android

查看:110
本文介绍了我怎么可以编辑文本文件的资产文件夹中的android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Android中的资产文件夹中的文本文件。我想动态改变该文本文件中的数据。我试图打开该文件,如下所示:

I am using a text file in the assets folder in Android. I would like to change the data inside that text file dynamically. I am trying to open the file as follows:

FileOutputStream fos=this.getAssets().openNonAssetFd("data.txt").createOutputStream();

但它产生错误: java.io.FileNotFoundException:此文件不能打开的文件描述符;它可能是COM pressed 。请帮我编辑这个文件。非常感谢你。

But it is generating the error: java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed. Please help me to edit this file. Thank you very much.

推荐答案

写入 /资产在运行时的目录? AFAIK这是不可能的。

Writing into /assets directory at runtime? AFAIK that's not possible.

您可以把 /资产原始文件,并在第一个应用程序运行在它复制到 / SD卡

You can put the original file in /assets, and at the first application run copy it over to the /sdcard.

这篇关于我怎么可以编辑文本文件的资产文件夹中的android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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