2). CheckBox的.isChecked()可判定有沒有被選到
//=============================================================
private CheckBox checkBox1_android_version;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
checkBox1_android_version = (CheckBox)
findViewById(R.id.checkBox1_android_version);
button = (Button) findViewById(R.id.submit);
button.setOnClickListener(listInfo);
}
private Button.OnClickListener listInfo = new Button.OnClickListener() {
@Override
public void onClick(View v) {
if (checkBox1_android_version.isChecked()) {
result.append("Android Version: "
+ SystemProperties.get("ro.build.version.release")
+ "\n\n");
}
}
};
沒有留言:
張貼留言