"Android" Pa4d_ch7 file, save status and preferences

Source: Internet
Author: User

The main points of knowledge in this chapter are as follows:

  • Learn about the shared Preferences
  • Interface Onsharedpreferencechangelistener A callback function can be called whenever a particular shared Preference is added, removed, or modified
  • Create preference screen (preference frame)
    • The
      • preferenceactivity,  applies to API level one (SDK3.0) before (XML config)
      • preferencefragment for API level one (S KD3.0) Later, the Compatible tablet (preserence-header configuration)
      • activity is dynamically configured according to the current version number
         Class C = Build.VERSION.SDK_INT < Build.version_codes. Honeycomb? Userpreferences. class   class  ;intent i  = new  Intent (  
      • Preference screen,  using Listpreference control, the default is to save a string type of value
      • can inherit components from preference screen and override components to implement various functions, such as selecting the color of a font in Settings
  • Save the fragment state after the activity is destroyed or hidden
    Setretaininstance (true);
  • Add a static file as a resource
  • Get a catalog using environment

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.