Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: How can i download a file from a URL to asset folder of the app?

Tags:

android

mobile

When I start running the app in the mobile, it must connect to a URL and download dataset(files) to the app folder of the app..Is this possible? if so please could you show me a sample ?

like image 839
elixir bash Avatar asked Oct 09 '22 16:10

elixir bash


2 Answers

you cannot download files in app's Asset folder. Instead you should use getCacheDir() (on internal memory) or getExternalCacheDir() (on SD card, available in Froyo and above) to download and retrieve your files.

like image 141
waqaslam Avatar answered Oct 12 '22 11:10

waqaslam


All the details are available here: http://developer.android.com/guide/topics/data/data-storage.html

like image 33
vedi Avatar answered Oct 12 '22 12:10

vedi