当前位置: 编程技术>移动开发
本页文章导读:
▪装置的search按钮调用自己程序的search模块 设备的search按钮调用自己程序的search模块
想在哪个Activity内调用自己程序定义的search模块,只需在这个activity对应的manifest文件中加上一个.........
▪ [转载]系统内置应用程序的升格 [转载]系统内置应用程序的升级
转自 http://blog.csdn.net/a345017062/archive/2010/11/10/6000709.aspx
写道
/system/app/下面内置了程序A,如果用户手动安装一个新的版本号时,apk会被安装在/data/app下.........
▪ 4.5 CheckBox施用 4.5 CheckBox应用
package com.chaowen;
import android.app.Activity;
import android.os.Bundle;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;
public class Ex04_05_checkBox2 extends Activity {
.........
[1]装置的search按钮调用自己程序的search模块
来源: 互联网 发布时间: 2014-02-18
设备的search按钮调用自己程序的search模块
想在哪个Activity内调用自己程序定义的search模块,只需在这个activity对应的manifest文件中加上一个meta-data
例如:
<meta-data android:name="android.app.default_searchable"
android:value=".ui.SearchActivity" />
android:name 是默认的字符串。
android:value 指向你要触发的searchable activity。
[2] [转载]系统内置应用程序的升格
来源: 互联网 发布时间: 2014-02-18
[转载]系统内置应用程序的升级
转自 http://blog.csdn.net/a345017062/archive/2010/11/10/6000709.aspx
写道
/system/app/下面内置了程序A,如果用户手动安装一个新的版本号时,apk会被安装在/data/app下,同时新版本的数据会覆盖老版本。但/system/app/下面的老版本程序不会被覆盖。这样用户删除升级后的程序,或者恢复出厂设置时,/system/app下面的程序还可以继续使用。
[3] 4.5 CheckBox施用
来源: 互联网 发布时间: 2014-02-18
4.5 CheckBox应用
package com.chaowen;
import android.app.Activity;
import android.os.Bundle;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;
public class Ex04_05_checkBox2 extends Activity {
/** Called when the activity is first created. */
private TextView mTextView1;
private CheckBox mCheckBox1;
private CheckBox mCheckBox2;
private CheckBox mCheckBox3;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//通过findViewById取得TextView对象并调整文字内容
mTextView1=(TextView)findViewById(R.id.myTextView1);
mTextView1.setText("你所选择的项目有:");
//通过findViewById取得三个CheckBox对象
mCheckBox1=(CheckBox)findViewById(R.id.myCheckBox1);
mCheckBox2=(CheckBox)findViewById(R.id.myCheckBox2);
mCheckBox3=(CheckBox)findViewById(R.id.myCheckBox3);
//声明并构造onCheckedChangeListener对象
CheckBox.OnCheckedChangeListener mcheckBoxChanged=new CheckBox.OnCheckedChangeListener(){
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
//通过getString()取得CheckBox的文字字符串
String str0="所选的项目为: ";
String str1=getString(R.string.str_checkbox1);
String str2=getString(R.string.str_checkbox2);
String str3=getString(R.string.str_checkbox3);
String plus=";";
String result="但是超过预算咯!!";
String result2="还可以再多买几本喔!!";
//任一CheckBox被勾选后,该CheckBox的文字会改变TextView的文字内容
if(mCheckBox1.isChecked()==true & mCheckBox2.isChecked()==true
& mCheckBox3.isChecked()==true)
{
mTextView1.setText(str0+str1+plus+str2+plus+str3+result);
}
else if(mCheckBox1.isChecked()==false & mCheckBox2.isChecked()==true
& mCheckBox3.isChecked()==true)
{
mTextView1.setText(str0+str2+plus+str3+result);
}
else if(mCheckBox1.isChecked()==true & mCheckBox2.isChecked()==false
& mCheckBox3.isChecked()==true)
{
mTextView1.setText(str0+str1+plus+str3+result);
}
else if(mCheckBox1.isChecked()==true & mCheckBox2.isChecked()==true
& mCheckBox3.isChecked()==false)
{
mTextView1.setText(str0+str1+plus+str2+result);
}
else if(mCheckBox1.isChecked()==false & mCheckBox2.isChecked()==false
& mCheckBox3.isChecked()==true)
{
mTextView1.setText(str0+str3+plus+result2);
}
else if(mCheckBox1.isChecked()==false & mCheckBox2.isChecked()==true
& mCheckBox3.isChecked()==false)
{
mTextView1.setText(str0+str2);
}
else if(mCheckBox1.isChecked()==true & mCheckBox2.isChecked()==false
& mCheckBox3.isChecked()==false)
{
mTextView1.setText(str0+str1);
}
else if(mCheckBox1.isChecked()==false & mCheckBox2.isChecked()==false
& mCheckBox3.isChecked()==false)
{
mTextView1.setText(str0);
}
}
};
//设置OnCheckedChangeListener给三个Checkbox对象
mCheckBox1.setOnCheckedChangeListener(mcheckBoxChanged);
mCheckBox2.setOnCheckedChangeListener(mcheckBoxChanged);
mCheckBox3.setOnCheckedChangeListener(mcheckBoxChanged);
}
}
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/myTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str_title"
>
</TextView>
<CheckBox
android:id="@+id/myCheckBox1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/str_checkbox1"
>
</CheckBox>
<CheckBox
android:id="@+id/myCheckBox2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/str_checkbox2"
>
</CheckBox>
<CheckBox
android:id="@+id/myCheckBox3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/str_checkbox3"
>
</CheckBox>
<TextView
android:id="@+id/myTextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
Strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, Ex04_05_checkBox2!</string>
<string name="app_name">Ex04_05_checkBox2</string>
<string name="str_title">我的消費券採購單</string>
<string name="str_checkbox1">泰國機票一張</string>
<string name="str_checkbox2">iPhone一台</string>
<string name="str_checkbox3">Android整合應用範例集一本</string>
</resources>
最新技术文章: