• <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 簡(jiǎn)單用法

            SharedPreferences 相當(dāng)于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 飛天 閱讀(671) 評(píng)論(0)  編輯 收藏 引用 所屬分類: Android

            導(dǎo)航

            統(tǒng)計(jì)

            常用鏈接

            留言簿(2)

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            Blogs

            搜索

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            久久AV高清无码| 欧美精品福利视频一区二区三区久久久精品| 久久午夜综合久久| 四虎影视久久久免费观看| 久久亚洲AV成人无码软件| 久久99久国产麻精品66| 麻豆一区二区99久久久久| 99热精品久久只有精品| 久久久久久国产a免费观看黄色大片 | 久久精品成人欧美大片| 久久久精品人妻一区二区三区四| 精品久久香蕉国产线看观看亚洲 | 国产成人久久精品一区二区三区| 999久久久无码国产精品| 久久久精品视频免费观看| 久久久久久毛片免费播放| 狠狠人妻久久久久久综合| 亚洲午夜久久久久久久久久| 国产精品欧美亚洲韩国日本久久| 国色天香久久久久久久小说 | 亚洲欧洲日产国码无码久久99| 91麻豆精品国产91久久久久久| 99蜜桃臀久久久欧美精品网站| 久久99精品久久久久久齐齐| 97精品久久天干天天天按摩| 久久久国产精华液| 伊人久久大香线蕉综合网站| 国产伊人久久| 国产日韩久久久精品影院首页| 老色鬼久久亚洲AV综合| 久久人妻少妇嫩草AV蜜桃| 人妻无码精品久久亚瑟影视| 精品国产综合区久久久久久| 久久综合综合久久狠狠狠97色88 | 午夜精品久久久久久久| 亚洲国产精品成人AV无码久久综合影院 | 国内精品久久久久久久久电影网| 国内精品九九久久久精品| 九九久久自然熟的香蕉图片| 性欧美丰满熟妇XXXX性久久久| 国产aⅴ激情无码久久|