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

            一、讀取內容

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

            二、寫入數據

            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) 評論(0)  編輯 收藏 引用 所屬分類: Android

            導航

            統計

            常用鏈接

            留言簿(2)

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            Blogs

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            久久久久四虎国产精品| 久久精品成人欧美大片| 国产精品久久午夜夜伦鲁鲁| 亚洲av成人无码久久精品| 国产精品国色综合久久| 久久国产成人午夜aⅴ影院| 日本加勒比久久精品| 中文字幕无码久久人妻| 精品久久久久久无码中文字幕一区 | 久久精品国产福利国产秒| 观看 国产综合久久久久鬼色 欧美 亚洲 一区二区 | 久久国产精品99精品国产987| 精品久久久久久无码中文字幕 | 国内精品久久久久伊人av| 久久久久黑人强伦姧人妻| 久久久久99精品成人片欧美| 午夜精品久久久久久久无码| 国内精品久久国产大陆| 青青草原综合久久大伊人| 欧美一区二区精品久久| 嫩草伊人久久精品少妇AV| 人妻少妇精品久久| 国产99久久九九精品无码| 亚洲成色WWW久久网站| 国产亚洲色婷婷久久99精品91| 无码专区久久综合久中文字幕 | 久久久噜噜噜久久熟女AA片| 久久精品夜色噜噜亚洲A∨| 久久99毛片免费观看不卡| 亚洲精品国产字幕久久不卡| 中文字幕久久精品| 久久青青草原亚洲av无码| 国产—久久香蕉国产线看观看| 精品免费久久久久久久| 日产精品久久久一区二区| 性欧美丰满熟妇XXXX性久久久| 蜜桃麻豆WWW久久囤产精品| 久久精品成人欧美大片| 国产成人精品综合久久久| 中文字幕日本人妻久久久免费 | 国产精品成人99久久久久|