由网友(吃我一记可爱杀)分享简介:我用这把我的文件位于src文件夹中的src / FILE1.TXT I am using this to get my File located in src folder src/file1.txtInputStream is = openFileInput("file1.txt");和使用的BufferedRe...
我用这把我的文件位于src文件夹中的src / FILE1.TXT
I am using this to get my File located in src folder src/file1.txt
InputStream is = openFileInput("file1.txt");
和使用的BufferedReader来读,但其投掷
and using BufferedReader to Read but its throwing
FileNotFoundException异常:数据/数据/包/文件/ FILE1.TXT
FileNotFoundException :data/data/package/files/file1.txt
同样的事情发生在
URL fileURL = getClass().getClassLoader().getResource("file1.txt");
你知道吗?/
Any idea?/
推荐答案
您src文件夹没有,也不会在你的模拟器或设备存在;它只存在于您的主机上。如果你想读的交付与你的应用程序的文件,把它放在任何你生的或资产的文件夹。
Your src folder doesn't and won't exist on your emulator or device; it only exists on your host machine. If you want to read in a file delivered with your app, put it in either your raw or assets folder.
相关推荐
最新文章