How to download a file to assets/www/ in android app? -


After

Then, I'm writing an Android app and I want to display it in WebView, so I found it displayed Is property / www and all that is a simple local .html file to do, but seems like I want to change the information, maybe some, how can I download the file from the application Say, dropbox and add it to property / www What? Just like anything:

  if (isOnline ()) {Downloads ("https://dl.dropboxusercontent.com/u/0000000/index.html", "property / www") } Else {Toast.makeText ("No Internet connection, this information may be outdated", Toast.LNNHHLLG). Show (); }  

I have written and worked the online () function, just download function is required, but I'm not sure where to start from

Edit, I've tried this so far:

  if (isOnline ()) {url try the URL {= new urRL ("https: // db .tt / WyAqN9r0 "); BufferedReader = new in BufferedReader (new InputStreamReader (url.openstream ())); String FILENAME = "tutortrusthandbook.html"; FileOutputStream fos = openFileOutput (FILENAME, context. MODE_PRIVATE); Letter string; While ((str = in.readLine ()) = faucet {fos.write (str.getBytes ()); } In.close (); Fos.close (); } Hold (malformedURLException e) {} hold (IOException e) {} hold (exception e) {Toast.makeText (getApplicationContext), "exception information" + e.getCause (), Toast.LENGTH_LONG) .show (); E.printStackTrace (); }} Webview Webview = (webview) Find VVBIID (RaidWebview1); Webview.loadUrl ("file: //tutortrusthandbook.html");  

But I'm not sure it is managing anything because I do not know how the file will now be displayed ...

How do I say from the app, download the dropbox file and put it in the property / www? You could not

You can not save assets only on runtime Save the downloaded file to internal memory ( getFilesDir () ) and load it In that WebView , if you do not have a download update to fall in your copy of the property. / P>


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -