美好的一天,我是否知道如何通过带按钮的单选按钮将主页链接到另一个活动页面?
答案 0 :(得分:0)
final RadioButton admin = (RadioButton) findViewById(R.id.radio1);
final RadioButton employee = (RadioButton) findViewById(R.id.radio2);
final Button go = (Button) findViewById(R.id.button1);
go.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (admin.isChecked())
{
Intent Intents= new Intent(YourActivity.this, Admin.class);
startActivity(Intents);
}
else if (employee.isChecked())
{
Intent Intentm = new Intent(YourActivity.this, Employee.class);
startActivity(Intents);
}
}
});
希望这有帮助。