Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: How to receive a complete html, with images and css files as string?

I'm looking for a way to cache my html, css and images on Android when only on wifi. If not on wifi the application is to read from the cache. I know a way this can be solved on iPhone ASIHTTPRequest, using Base64 encoding.

So, how to receive a complete html, with images and css files as string, so that I can store it on the phone and display it in offline mode?

EDIT - RESOLVED

  1. Get the html using HttpClient
  2. Matching all src and href tags (src|href)s*=s*\"([^\"]+)\"
  3. Get the file from server and converts it with Base64
  4. Replaces the filename tag with the converted Base64 string in the html
  5. Insert the new html string to a Sqlite database ready for use :)
like image 963
Jan-Terje Sørensen Avatar asked Nov 14 '22 08:11

Jan-Terje Sørensen


1 Answers

you can use HttpClient class to download html file and other related file and store it.

like image 146
Kunal Avatar answered Nov 16 '22 04:11

Kunal