• <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)論排行榜

            久久99热国产这有精品| 亚洲国产成人精品女人久久久| 国产69精品久久久久观看软件| 久久久久国产精品人妻| 国色天香久久久久久久小说 | 亚洲欧美久久久久9999| 亚洲AV日韩精品久久久久| AA级片免费看视频久久| 久久亚洲国产精品成人AV秋霞 | 思思久久好好热精品国产| www性久久久com| 无码任你躁久久久久久久| 狠狠色噜噜狠狠狠狠狠色综合久久 | 99久久国产亚洲综合精品| 久久―日本道色综合久久| 亚洲国产视频久久| 99久久国产热无码精品免费久久久久| 亚洲人AV永久一区二区三区久久| 久久99国产精品久久99| 久久WWW免费人成一看片| 日韩电影久久久被窝网| 国产精品熟女福利久久AV| 91精品国产9l久久久久| 无码专区久久综合久中文字幕| 久久一区二区三区免费| 国产精品gz久久久| 国产精品一区二区久久精品无码| 国内精品九九久久久精品| 久久综合香蕉国产蜜臀AV| 亚洲精品无码久久千人斩| 伊人久久大香线蕉综合Av| 狠狠色综合网站久久久久久久高清| 欧美午夜A∨大片久久 | 国产A三级久久精品| 免费精品久久天干天干| 人人妻久久人人澡人人爽人人精品| 日韩美女18网站久久精品| 久久一区二区三区99| 伊人情人综合成人久久网小说| 亚洲午夜福利精品久久| 久久香综合精品久久伊人|