Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating and deleting a file in assets folder automatically [duplicate]

Possible Duplicate:
how we can remove a file from the assets folder at runtime in android?

Is it possible to create a file in assets folder when an application is run and delete the same file when the app is stopped.

like image 252
SRINIVAS RAO Avatar asked Dec 22 '12 06:12

SRINIVAS RAO


2 Answers

For asset you have read file permission only. So you cannot create / delete files in assets folder. Following are the restrictions applied to assets folder.

1)  Only Read Permission available for this folder.

2)  File size for placing inside the assets limit to 10 MB.If you want to place     
    then the larger file should be placed as chunk.

3)  You can use this folder, for placing files like database file, font file etc...

Don't fight with it. It is not a proper way of dealing with files using assets folder. You can use SDcard that is suitable location for creating and deleting files

You can use standard method for placing files in SDcard through app,

 Environment.getExternalStoragePublicDirectory("filetype");
like image 142
RajeshVijayakumar Avatar answered Oct 13 '22 03:10

RajeshVijayakumar


The apk is read only and the assets/ folder is not modifiable at runtime, which sounds like something you may be seeking. Check this question

like image 37
Rahul Avatar answered Oct 13 '22 03:10

Rahul