I want to delete a file in assets folder in run-time. I have a database file in assets folder that copies to data folder at run-time but after installing my app the size of app become twice as large (assets + data folder)!
How I can delete database file from assets folder to avoid this?
You can't delete a file at runtime that was delivered with your App.
See this discussion about it:
How to remove a file in assets at run time?
The whole content of your APK is read only and can not be modified
in addition to the above answer, one thing you can do is preferExternalStorage in manifest..which will help
Related
I'm trying to build a search engine in java where i have a folder "crawler" to store downloads but when I open my project and click on that file my computer gets stuck because it tries to load all the urls and texts parsed from the html pages (100k+) and tries to show them in .txt files in the "crawler" folder.
How can I prevent loading and showing them in the file ?
Store your data files somewhere outside of your project. Use e.g. a properties file to store the location to your crawler folder. You should only include such files in your project like source code. Something you would upload to Git or SVN. Not the data files your application operates on. If you would store this data in a database, you wouldn't include the whole database in your project, but only the SQL files to create the tables and views.
I want to create a hidden folder in user's Google drive root directory and then want to insert some text files in that folder and later want to retrieve that files. I tried the quick guide and files are uploading fine but in the root directory and files are visible to user. From here I know how to create an empty folder. . But from here I do not understand how to use that code to insert the file in a particular folder.
So my Question is how to create hidden folder and perform CURD operations on files using drive API.
You're looking for the appdata folder. See here:
https://developers.google.com/drive/appdata
After searching 1 hour i do not found any solution to my problem.
I want to move a file from sdcard to assets folder and also overwrite the existing file in assets folder (both file are sqlite database have same name with just a little difference in data )
??
Actually, The behaviour of the android .apk file is read only so the directory structure which are in that apk file follows the same, So no one can write this files or make changes on that at runtime,that's why You can't make a changes in /asset folder at runtime. you can read file from it (means copy files which are available in asset to any internal storage or /sdcard but not write it to vice-versa)
Its apply on all the directories which are build in .apk files. As per docs.
Assets folder are not Writable it is only readable so you cant copy from sdcard to assets, yes you can copy from assets to sdcard
If you want other apps not to access your database then what you can do is
Download the database from website. create a temp database also in app directory.
getDatabasePath() this will give you the path of the dummy database you have created now replace this with the one you downloaded.
PS.: User and apps having root access still able to access it and you cant do anything in that scenario
i want to download folder containing files like pdf,jpg,png etc from web services.I have written a application that can download pdf,png file.But i want to download folder containing several files. So my question is- is it possible to download folder and if yes then how can i download folder from server in android. thank you
If you can download one file, why wouldn't you be able to download several? Create the folder on Android, queue the files and start the next download when the current is finished, filling the folder. Also Android supports ZIP, so that might be your best call.
Folder is nothing but an FILE but a different type of file. Once you get the folder you can list down the files in it. You already have URL with the folder, u just need to append the URL of the folder to the files in it and download them one by one.
Can i push an apk file into my assests folder programmatically?I wanted to use this apk file
in my application.
Please forward your valuable suggestions to me.
Thanks in advance...
Priya
AFAIK, you can't store it in the assets directory. However you can store is some where on the sdcard or cache directory. Check this for different data storage methods available.