Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Android Radio Button

Tags: void
public Void addListenerOnButton()
{
radiogroup=(RadioGroup)findViewById(R.id.radiogroup);
button=(Button)findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View view) {
int selected_id=radiogroup.getCheckedRadioButtonId();
radiobutton=(RadioButton)findViewById(selected_id);
Toast.makeText(MainActivity.this,radiobutton.getText().toString(),Toast.LENGTH_SHORT).show();
}
});
}


This post first appeared on AR Programming, please read the originial post: here

Share the post

Android Radio Button

×

Subscribe to Ar Programming

Get updates delivered right to your inbox!

Thank you for your subscription

×