Good day, May I know how to link main page to another activity page through radio button with button?
Asked
Active
Viewed 157 times
-1
-
perhaps this will point you in the right direction: http://stackoverflow.com/questions/4186021/how-to-start-new-activity-on-button-click – Stuart Siegler Nov 15 '16 at 01:34
-
yeah it is simple one as you are using button – Yuichi Akiyoshi Nov 15 '16 at 02:20
-
@ZhaoLin Thanks for your reply. I really appreciate it. I initial planing is to make an option for the user to choose enter admin or employee activity page through radio button – Shun Jian Nov 15 '16 at 04:04
-
@StuartSiegler thanks for your guidance. – Shun Jian Nov 15 '16 at 04:05
1 Answers
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);
}
}
});
Hope this helps.

John Joe
- 12,412
- 16
- 70
- 135