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

            導航

            統計

            常用鏈接

            留言簿(2)

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            Blogs

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            久久综合九色综合久99| 亚洲国产日韩欧美久久| 嫩草伊人久久精品少妇AV| 日本精品久久久中文字幕| 久久综合亚洲色HEZYO国产| 国内精品久久久久影院一蜜桃| 久久国产V一级毛多内射| 久久精品一本到99热免费| 亚洲国产精品一区二区三区久久| 久久人人爽人人爽人人片AV高清| 久久99精品国产麻豆不卡| 伊人久久大香线蕉综合网站| 精品久久久久久国产潘金莲| 狠狠人妻久久久久久综合| 一本色道久久HEZYO无码| 免费精品久久天干天干| 久久久久香蕉视频| 久久99精品国产麻豆婷婷| 久久久久亚洲av成人网人人软件| 国产V综合V亚洲欧美久久 | 久久久久久青草大香综合精品| 亚洲欧洲日产国码无码久久99| 午夜精品久久久久久久无码| 久久久精品国产亚洲成人满18免费网站| 亚洲人成精品久久久久| 国产精品美女久久久网AV| 久久有码中文字幕| av无码久久久久不卡免费网站 | 久久www免费人成精品香蕉| 久久综合狠狠综合久久 | 久久国产精品成人免费| 青青草国产精品久久| 一本久久a久久精品vr综合| 日韩亚洲国产综合久久久| 久久久受www免费人成| 久久99国产精品成人欧美| 色成年激情久久综合| 久久国产精品久久| 99久久免费国产精品| 91精品国产91久久久久久蜜臀| 99久久国产综合精品网成人影院 |