如何编写Android中的原始文件夹中的文件? [英] How to write a file in Android to the raw folder?

查看:193
本文介绍了如何编写Android中的原始文件夹中的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得这是一个pretty基本问题。

I think this is a pretty basic question.

我目前正在写一个文件是这样的:

I am currently writing a file like this:

File output = new File("exampleout.mid");

现在,我想将文件写入../的myproject / RES /原料

Now, I want to write the file to ../myproject/res/raw

我看我可以把完整的URL在做到这一点。但。由于这是一个Android应用程序。什么是完整网址?我不;吨有写/ /.../家myproject的/...?

I read I could do it by putting the complete url in the "". BUT. Since this is an Android app. What is the full url? I don;t have to write /home/.../myproject/...?

是解决方案:

File output = new File("/res/raw/exampleout.mid");

还是我需要一个更高的URL结构?

Or do I need a higher url structure?

对不起问这个简单的问题,但因为我使用Android模拟器,我不能检查,如果该文件实际上是在正确的地方。

Sorry about asking this simple question, but since I use an Android emulator, I cannot check if the file is actually in the right place.

推荐答案

您不能写入文件到原始文件夹。它的只读。 precisely不能修改包含在对飞RES文件夹中任何事情。

You cannot write a file to raw folder. Its read-only. Precisely you can't modify anything contained within "Res" folder on the fly.

检查了这一点, http://stackoverflow.com/a/3374149

这篇关于如何编写Android中的原始文件夹中的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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