0

I am making hybrid application.I have one file in this directory assest->www->ATMS.html or other js files.So I load in web view like this.

web.loadUrl("file:///android_asset/www/a.html");

I want to copy all file files and folders which is inside the asset folder.Instead of loading from assest folder .I need to load from copy folder.As some some told me that there is file system of APK file.Mean we can copy all files in apk file system .and load html from that APK file system .

There is few link give information to copy of assest folder How to copy files from 'assets' folder to sdcard? But I don't get knowledge how to copy in APK file system .Mean when Aplication uninstall it remove the copied folder .When application launch it make copy of assest folder in apk file system ..

thanks

Community
  • 1
  • 1
Pallavi Sharma
  • 635
  • 2
  • 16
  • 45
  • An apk itself is read only, however an installed application instance will have a "private directory" in the "internal storage" which is indeed a file system, and *should* be deallocated on uninstall. You should be able to follow the other directions, only use Context.getFilesDir() to find the root location of this storage, and skip the external storage permission unless you have some other reason for needing it. – Chris Stratton Jul 29 '14 at 14:28
  • please read my below comments..and suggest some solution.I try to explain below the answer .why I am doing so – Pallavi Sharma Jul 29 '14 at 14:33
  • I have already provided you a path to a solution above - Follow the directions you found for making a copy on External Storage but make those two changes. – Chris Stratton Jul 29 '14 at 14:34
  • @ChrisStratton thanks for providing ..Actually I am not perfect android developer .I am hybrid devloper.so suggest how I Context.getFilesDir() – Pallavi Sharma Jul 29 '14 at 14:36
  • @ChrisStratton if you have any example which copy the asset file and open that file(copied) in web view.second work I will do own mean to download file from server – Pallavi Sharma Jul 29 '14 at 14:37
  • any update of this Question – Pallavi Sharma Jul 29 '14 at 14:57

1 Answers1

0

Not sure I get your question fully right as explanation is bit messy, but while APK is ZIP file, you should really consider it read-only. So you can copy files out of it but you cannot add anything to your APK nor alter it at runtime.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
  • we cann't make dublicate of assest folder..when application lauch – Pallavi Sharma Jul 29 '14 at 14:10
  • Mean why I doing so ..there is reason..I will explain take a example I have two files in assest folder "index.html"and "hh.js".I load from "index.html" from the copied folder in web view .and update "hh.js" file from server ..mean I update "hh.js" from the server before application lauch – Pallavi Sharma Jul 29 '14 at 14:12
  • Not sure you are asking or what? Can you rephrase your comment? – Marcin Orlowski Jul 29 '14 at 14:12
  • I do not really care at the moment **why** you want that. I basically try to say that if I understand **what** you want to do, then you simply can't. So work on your question if needed as it's bit messy – Marcin Orlowski Jul 29 '14 at 14:13
  • Till now I am loading "html" file from the assest folder .Now I want to load from the copy folder having html file.and download js file from the server and put it into copied folder location – Pallavi Sharma Jul 29 '14 at 14:16
  • Now I am trying to do when application launch I download assest folder at any location.and hit the server load js file. then open the web view with html file (copied folder) – Pallavi Sharma Jul 29 '14 at 14:19