I am creating an android application that fetch data online using jso开发者_如何学Cn. I want to display the previous content if offline . Can anyone please suggest a solution for this? Thanks, in advance.
If you use the HttpURLConnection everything is automatically cached for you. Check out http://android-developers.blogspot.com/2011/09/androids-http-clients.html and http://developer.android.com/reference/java/net/HttpURLConnection.html for details.
You have various options. Read the development guide topic Data Storage. I'd recommend using either storage or an SQLite data base. Depending on how much data you are caching, you might consider using external storage, just so that your app will be a good citizen on the user's phone.
you need to use appcache for displaying the content offline. Android supports html5 appcache
You need to use HTML5 features Application Cache, this is the easiest way for displaying the whole content of a webpage offline.
精彩评论