I have developed an application which read text file. In Emulator I have push the file in \Data\Data\Packa开发者_如何学JAVAgeName\File.txt and its working fine. But when I try to push file in Device its generate the error Read Only File System. I have try to remount directory as writable but the same error. Please help me how can I push file into device.
The folder you are trying is locked on non-rooted phones i.e no write permission
and I guess the device you are trying on is not a rooted one. since emulator is sort of developer device which is said to be rooted that's why you can push file to that location.
So depending on your requirement you have to either use Assest folder or File system storage
Update: How to use assest folder
Resources r = getResources();
AssetManager assetManager = r.getAssets();
InputStream in = assetManager.open(filename);
In practice, we can push such file in assets folder. Assets folder is there for you to put such raw files to be used inside the application.
精彩评论