Android offline cache data

Source: Internet
Author: User

When we look at some of the better apps, when there is no net, the first layer of the interface is data, like many e-commerce apps,


This is its main interface, I am now in the case of no network to come in, but still can show the original data, the data and pictures, of course, the use of the cache, said the first cache, such as the essence, stars, beauty, and so on these first interface, when clicked in will not show the data, If you do not cache the user come in and see nothing, the user experience is not very good, the mobile internet era, the user experience is referred to a very high height, because if an app users a lot, even if the company is not profitable, but there is still a strong market, the company's next financing is also very good, Mobile market is to first bind users and then consider the business value, nonsense said, how he did cache, and how to cache,


Ideas:

1: When in the case of a network, the background request for the successful JSON data cache to the file, is generally cached in the sharedpreferences

2: Create a subfolder when loading the picture, and then store the picture in that directory

3: In the case of no network can get the cached JSON data, and then parse the JSON data, if there is a picture, according to the name of the url+ subfolder of these pictures to load the picture, through bitmap bitmap = bitmapfactory.decodefile (url ); Get the picture and then come out now


This is probably the case, the specific requirements according to business needs to design.


Android offline cache data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.