The Databasehelper of Settingsprovider

Source: Internet
Author: User

Reprint Please specify source: http://blog.csdn.net/droyon/article/details/35558375


1. Create a global table for the owner only.
Only create the global table for the singleton ' owner ' user        //created for the owner of the global table only.        if (Muserhandle = = Userhandle.user_owner) {            createglobaltable (db);        }

2,//If we are encrypting the device, only the "core" application can be run. Onlycore is True

        if (!onlycore) {            loadbookmarks (db);        }

3. A secure table was created at Settings.db's upgradeversion of 26 o'clock. Transfer some of the configuration items to secure at UpgradeVersion 27, 52, and 55 o'clock.
UpgradeVersion = 70 o'clock, update bookmarks

4. The global table was created at Settings.db's upgradeversion = 82 o'clock. Move to Per-user settings dbs
Create Movetosystem or Movetosecure in Settings.java, and pass Settingsprovider to Databasehelper.

UpgradeVersion = 84, 87,89, 90, 93 o'clock, ported from secure to global.

UpgradeVersion = 85, 88, 90, 91, 93 o'clock, ported from system to global.
5, <fraction name= "Def_window_animation_scale" >100%</fraction>

6, the definition of variables in Settingsprovider, note that the prefix and suffix are important, remember.

The items that match the prefix specification are ported to secure based on the prefix in the search.
private void Moveprefixedsettingstonewtable (Sqlitedatabase db, String SourceTable, String desttable, string[]        Prefixestomove) {sqlitestatement insertstmt = null;        Sqlitestatement deletestmt = null;        Db.begintransaction (); try {insertstmt = db.compilestatement ("INSERT into" + DestTable + "(name,value) SELECT NA Me,value from "+ SourceTable +" WHERE substr (name,0,?)            =?"); deletestmt = Db.compilestatement ("DELETE from" + SourceTable + "WHERE substr (name,0,?)            =?");                for (String prefix:prefixestomove) {insertstmt.bindlong (1, prefix.length () + 1);                Insertstmt.bindstring (2, prefix);                Insertstmt.execute ();                Deletestmt.bindlong (1, prefix.length () + 1);                Deletestmt.bindstring (2, prefix);            Deletestmt.execute ();        } db.settransactionsuccessful (); } finally {db.endtransaction ();            if (insertstmt! = null) {insertstmt.close ();            } if (deletestmt! = null) {deletestmt.close (); }        }    }





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.