• <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

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            日韩一区二区久久久久久| 色婷婷狠狠久久综合五月| 久久99精品久久久久子伦| 久久狠狠色狠狠色综合| 久久强奷乱码老熟女网站| 亚洲人成伊人成综合网久久久| 久久综合亚洲欧美成人| 久久综合色区| 国产欧美一区二区久久| 99久久精品免费看国产一区二区三区 | 久久A级毛片免费观看| 国产精品一区二区久久精品无码 | 亚洲午夜久久久久妓女影院| 精品久久久久久中文字幕| 久久精品国产2020| 久久精品成人免费国产片小草 | 久久99国产精品久久99小说 | 久久精品综合网| 久久久久女教师免费一区| 99久久婷婷国产综合精品草原| 久久AV无码精品人妻糸列| 思思久久99热只有频精品66| 精品久久久久久久久久中文字幕| 国产精品久久亚洲不卡动漫| 亚洲欧美日韩中文久久| 亚洲色婷婷综合久久| 久久人人爽人人爽人人片AV麻烦| 久久久久久久亚洲精品| 久久亚洲中文字幕精品一区四| 久久国产高清一区二区三区| 久久久久久免费一区二区三区| 久久精品蜜芽亚洲国产AV| 亚洲国产精品无码久久久秋霞2 | 久久精品?ⅴ无码中文字幕| 国产精品久久久99| 精品久久人人做人人爽综合| 国产AV影片久久久久久 | 久久久青草久久久青草| 91精品国产91久久久久久青草| 国产成人99久久亚洲综合精品| 久久久久18|