How to add one perference into the settings option
来源:互联网 发布:a*算法详解 编辑:程序博客网 时间:2024/05/07 17:08
under the settings ,it has alot of options for us to set, there are two ways to add some app into the setting perference.
1. write an app separating from the settings source code,it is an independent app .
Just the inputmethod can do like this.
2. change the settings source code.
Today we talk about this way.
*****************************************************************
First ,you should add the activity that you want to write into the AndroidManifest.xml
Like
<activity android:name="ExampleSettings" android:label="@string/example_settin
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
also add the layout that pressing the perference that you add .
under the /res/layout/ ,and the add some item into strings.xml
************************************************************************
Second
add one perference into the exsit xml file
Like
<PreferenceScreen
android:key="button_example_key"
android:title="@string/example_settings"
android:summary="set and get the example number">
</PreferenceScreen>
add source java code under the exsit java file.
Like
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
init code>>>>>>>>>>>>>>>
private static final String BUTTON_EXAMPLE_KEY = "button_example_key";
private PreferenceScreen mButtonExampleKey;
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
detect code>>>>>>>>>>>>
else if(preference == mButtonExampleKey){
Intent intent_example = new Intent(this,ExampleSettings.class);
intent_example.setAction(Intent.ACTION_MAIN);
startActivity(intent_example);
return true;
}
mButtonExampleKey =(PreferenceScreen) prefSet.findPreference(BUTTON_EXAMPLE_KEY);
- How to add one perference into the settings option
- how to add a member into the PDS using JCL
- How to add a logo into the gerber file?
- How to see the Master Page option Under Look and Feel in site settings?
- How to add extended Quick Settings
- How to add SMSC feature into Android
- How to add project into Android BSP
- FFMPEG -- How to add one new CODEC
- How to burn subtitles into the video
- How to merge multiple images into one image - Java ImageIO
- How to turn a negative outlook into a positive one
- Ruby, how to shuffle one array into another
- Log4net - How to add a converter into log4net.Util.PatternString
- How to add a new package into BuildRoot
- How to Add Line Number into Oracle Form
- How to add app link into home screen/apps pages
- How to add a volume into HA cluster
- [tfs] How to add report builder into report site
- JQuery ajax参数表
- 一步一步培养领导气质
- XML
- stuct2 乱码
- 百度能否抢占移动搜索市场话语权?
- How to add one perference into the settings option
- 设计与开发应用服务器(一)------常见模式
- 如何正确的完全卸载MySQL
- JAVA pattern
- 查看xx进程打开的所有文件
- 酒后赠文友
- iphone OS 4.0操作系统中多任务~禁止后台执行的方法
- VS2008:log4net.dll 使用
- 哈希查找