如果有人帮助我使用此代码,我将不胜感激:
1- 我有 3 个 RadioButton 用于 3 个活动 English.class、France.class、Italian.class 供用户在应用启动时选择默认语言。有人可以帮我如何实现它..?
public class Settings extends Activity {
private RadioGroup radioLaGroup;
private RadioButton radioLaButton;
private CheckBox chk_clear;
private Button btnDisplay;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings);
addListenerOnButton();
addListenerClear();
}
public void addListenerOnButton() {
radioLaGroup = (RadioGroup) findViewById(R.id.radioLa);
btnDisplay = (Button) findViewById(R.id.btnDisplay);
btnDisplay.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// get selected radio button from radioGroup
int selectedId = radioLaGroup.getCheckedRadioButtonId();
// find the radiobutton by returned id
radioLaButton = (RadioButton) findViewById(selectedId);
}
});
}
}
提前致谢.....