• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            飛天

            快樂的生活......

             

            SharedPreferences 簡單用法

            SharedPreferences 相當于Ini文件功能。是以xml文件形式保存。
             SharedPreferences android.content.ContextWrapper.getSharedPreferences(String name, int mode)



            public SharedPreferences getSharedPreferences (String name, int mode) 
            Since: API Level 1 
            Retrieve and hold the contents of the preferences file 'name', returning a SharedPreferences through which you can retrieve and modify its values. Only one instance of the SharedPreferences object is returned to any callers for the same name, meaning they will see each other's edits as soon as they are made.

            Parameters
            name  Desired preferences file. If a preferences file by this name does not exist, it will be created when you retrieve an editor (SharedPreferences.edit()) and then commit changes (Editor.commit()). 
            mode  Operating mode. Use 0 or MODE_PRIVATE for the default operation, MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE to control permissions. The bit MODE_MULTI_PROCESS can also be used if multiple processes are mutating the same SharedPreferences file. MODE_MULTI_PROCESS is always on in apps targetting Gingerbread (Android 2.3) and below, and off by default in later versions. 

            Returns
            Returns the single SharedPreferences instance that can be used to retrieve and modify the preference values.

            一、讀取內(nèi)容

               SharedPreferences preferences = getSharedPreferences("PCINFO", MODE_APPEND);
            String strAddr = preferences.getString("PCADDR", "10.0.2.2");
            String strPort =  preferences.getString("PCPORT","6699");

            二、寫入數(shù)據(jù)

            SharedPreferences preference = getSharedPreferences("PCINFO", MODE_APPEND ) ;
            Editor editor = preference.edit();
            editor.putString("PCADDR", strAddr);
            editor.putString("PCPORT", strPort);
            editor.commit();

            posted on 2011-11-17 14:01 飛天 閱讀(684) 評論(0)  編輯 收藏 引用 所屬分類: Android

            導航

            統(tǒng)計

            常用鏈接

            留言簿(2)

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            Blogs

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            精品国际久久久久999波多野| 久久影院综合精品| 亚洲欧洲久久久精品| 日韩精品久久无码中文字幕| 大伊人青草狠狠久久| 精品久久久久久久久久中文字幕 | 国产成人无码精品久久久性色| 亚洲色欲久久久综合网东京热 | 色综合合久久天天给综看| 少妇熟女久久综合网色欲| 99久久精品国产麻豆| 久久精品桃花综合| 伊人色综合久久天天| 亚洲中文精品久久久久久不卡| 精品无码久久久久久国产| 无码AV波多野结衣久久| 久久婷婷五月综合成人D啪| 69久久精品无码一区二区| 久久精品国产欧美日韩99热| 亚洲综合精品香蕉久久网97| 久久天堂AV综合合色蜜桃网| 亚洲?V乱码久久精品蜜桃| 久久香蕉一级毛片| 久久精品亚洲精品国产色婷| 99久久无色码中文字幕人妻| 免费精品国产日韩热久久| 久久精品成人免费国产片小草| 精品久久一区二区三区| 国内精品久久久人妻中文字幕| 97精品依人久久久大香线蕉97 | 人妻无码αv中文字幕久久琪琪布| 国产精品乱码久久久久久软件| 久久久99精品成人片中文字幕 | 99久久婷婷国产综合亚洲| 久久久久久夜精品精品免费啦| 亚洲香蕉网久久综合影视| 久久99精品国产麻豆宅宅| 99久久99久久精品国产片果冻| 亚洲精品无码久久久久去q| 亚洲色婷婷综合久久| …久久精品99久久香蕉国产|