<RadioGroup>
<TableRow>
<RadioButton
android:id="#+id/a"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="lolo"
/>
<RadioButton
android:id="#+id/b"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="sh"
/>
</TableRow>
<TableRow>
<RadioButton
android:id="#+id/c"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="s"
/>
<RadioButton
android:id="#+id/d"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="cannot be determined"
/>
</TableRow>
</RadioGroup>
i want to select one rdio button out of four it is acing like 4 seperate radio button??? ,all r getting selected,i'm new in android develoment so kindly guide me thanx
The RadioButton views must be immediate children of the RadioGroup, for the group-effect to work.
So, if you add 'TableRow' under RadioGroup, the group nature that should be seen on RadioButton will not function.
For RadioButton's grouping to work, try something like this.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center" >
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RadioButton
android:id="#+id/a"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="lolo" />
<RadioButton
android:id="#+id/b"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="sh" />
<RadioButton
android:id="#+id/c"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="s" />
<RadioButton
android:id="#+id/d"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="cannot be determined" />
</RadioGroup>
</RelativeLayout>
If you are so concerned about the row-column structure, then use your own layout XML file itself and implement setOnCheckedChangeListener(listener) on the radio buttons. When any of the radiobutton gets clicked, corresponding listener block will be called and then uncheck other radio buttons.
I think you have used radio group and define radio button inside that group this is correct but refer this link Radio Button Group this might be useful
try this:
<RadioGroup
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow>
<RadioButton
android:id="#+id/a"
android:text="lolo"
android:button="#drawable/btn_touch"/>
<RadioButton
android:id="#+id/b"
android:text="sh"
android:button="#drawable/btn_touch"/>
</TableRow>
<TableRow>
<RadioButton
android:id="#+id/c"
android:text="s"
android:button="#drawable/btn_touch"/>
<RadioButton
android:id="#+id/d"
android:text="cannot be determined"
android:button="#drawable/btn_touch"/>
</TableRow>
</RadioGroup>
where btn_touch in drawable folder is:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- When selected, use grey -->
<item android:drawable="#drawable/selected1"
android:state_checked="true"/>
<!-- When not selected, use white-->
<item android:drawable="#drawable/unselected1"/>
</selector>
Maybe this could help you if you want to keep the buttons on split rows:
1. Remove the group from your xml since you don't need it :
<TableRow>
<RadioButton
android:id="#+id/a"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="lolo" />
<RadioButton
android:id="#+id/b"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="sh" />
</TableRow>
<TableRow>
<RadioButton
android:id="#+id/c"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="s" />
<RadioButton
android:id="#+id/d"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="cannot be determined" />
</TableRow>
2. Use this in your activity to make it work:
private RadioButton a;
private RadioButton b;
private RadioButton c;
private RadioButton d;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
ButtonChange clRadio = new ButtonChange();
a = (RadioButton) findViewById(R.id.a);
b = (RadioButton) findViewById(R.id.b);
c = (RadioButton) findViewById(R.id.c);
d = (RadioButton) findViewById(R.id.d);
a.setOnCheckedChangeListener(clRadio);
b.setOnCheckedChangeListener(clRadio);
c.setOnCheckedChangeListener(clRadio);
d.setOnCheckedChangeListener(clRadio);
...
}
public class ButtonChange implements OnCheckedChangeListener() {
#Override
public void onCheckedChanged(CompoundButton radio, boolean isChecked) {
if(isChecked)
switch(radio.getId()) {
case R.id.a:
case R.id.b:
case R.id.c:
case R.id.d:
a.setChecked(false);
b.setChecked(false);
c.setChecked(false);
d.setChecked(false);
radio.setChecked(true);
break;
default :
break;
}
}
}
}
This should do the trick.
Related
in android, I write a code for ask questions from user.answers show in RadioGroup that have multiple RadioButton, but when user click on a RadioButton, that RadioButton does not fill in the graphic.
code of radioGroup.setOnCheckedChangeListener is here:
holder.radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener()
{
#Override
public void onCheckedChanged(final RadioGroup group, final int checkedId) {
rb = group.findViewById(checkedId);
try {
//set time in mili
Thread.sleep(500);
}catch (Exception e){
e.printStackTrace();
}
if (correctAns.equals(rb.getText())) {
if (itemList.get(position).getLevel().equals("el"))
sumResultEl++;
else if (itemList.get(position).getLevel().equals("pre"))
sumResultPre++;
else
sumResultInter++;
}
there is RecyclerView.my questions show by RecyclerView.
xml of questions is here:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:gravity="center">
<ScrollView
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_gravity="center"
android:orientation="vertical">
<LinearLayout
android:orientation="vertical"
android:layout_gravity="center"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true">
<TextView
android:id="#+id/question_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:textSize="20dp"
android:paddingLeft="10dp"/>
<RadioGroup
android:id="#+id/radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
>
<RadioButton
android:id="#+id/radio_button_answer1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:checked="false"
android:padding="10dp"
android:background="#android:color/white"/>
<RadioButton
android:id="#+id/radio_button_answer2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:checked="false"
android:padding="10dp"
android:background="#android:color/white"/>
<RadioButton
android:id="#+id/radio_button_answer3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:checked="false"
android:padding="10dp"
android:background="#android:color/white"/>
<RadioButton
android:id="#+id/radio_button_answer4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:checked="false"
android:padding="10dp"
android:background="#android:color/white"/>
</RadioGroup>
</LinearLayout>
</ScrollView>
</LinearLayout>
Please check your app theme.
Especially the colorAccent. If it is same as colorPrimary then that might be the issue for the graphics
It might be due to the same color of background as well as of radio button's tint
Try setting RadioGroup background to white
Add below line to your RadioGroup
android:background="#android:color/white"
edit: Everything works fine for me here with your provided xml code.
But Thread.sleep(500) pauses your main thread for half second.
Instead use
`handler.postDelayed(runnable, delayInMillis);`
Also I suspect that your style is modified (colorPrimary, colorAccent etc.) please check that
I do try to get text datas from JSON, i do. But when it is time to write they are not exactly fitting. My XML file is here...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/txt_questionAdjective"
android:layout_width="fill_parent"
android:layout_height="139dp"
android:layout_gravity="center_vertical"
android:layout_marginTop="15dp" />
<RadioGroup
android:id="#+id/grp_options"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RadioButton
android:id="#+id/rdb_optionA"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp" />
<TextView
android:id="#+id/txt_optionA"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<RadioButton
android:id="#+id/rdb_optionB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp" />
<TextView
android:id="#+id/txt_optionB"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<RadioButton
android:id="#+id/rdb_optionC"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp" />
<TextView
android:id="#+id/txt_optionC"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<RadioButton
android:id="#+id/rdb_optionD"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp" />
<TextView
android:id="#+id/txt_optionD"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RadioGroup>
</LinearLayout>
And what it looks like after that.
How can i set C and D options next to radiobuttons ? Thanks in advance.
EDIT:SOLVED I deleted the textView parts in XML and used the for loop which #Gabriella Angelova provided me. That really helped. Thanks.
You could use the following code snipet to set the text of your radio buttons dynamically:
RadioGroup radioGroup = (RadioGroup)findViewById(R.id.grp_options);
for (int i = 0; i < radioGroup .getChildCount(); i++) {
((RadioButton) radioGroup.getChildAt(i)).setText(*your value from JSON*);
}
radioButton.setText("your text");
I am making an app in which I want to design the options in 2*2 radio buttons.For this I am doing the following thing but getting "android.widget.RelativeLayout cannot be cast to android.widget.RadioButton" error
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TableRow>
<FrameLayout
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
</TableRow>
<TableRow>
<TextView android:id="#+id/textMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_marginTop="100dp"
android:gravity="center|left"/>
</TableRow>
<TableRow>
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/group"
android:layout_marginLeft="25dp"
android:orientation="horizontal"
android:layout_span="2"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RadioButton android:id="#+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<RadioButton android:id="#+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/btn1"/>
<RadioButton android:id="#+id/btn3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/btn1" />
<RadioButton android:id="#+id/btn4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/btn2"
android:layout_toRightOf="#id/btn3"/>
</RelativeLayout>
</RadioGroup>
</TableRow>
<Button android:id="#+id/submitbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit"
android:visibility="gone"
android:layout_below="#id/group" />
<TextView android:id="#+id/tv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/submitbtn"/>
</TableLayout>
Please help in this I am stuck since morning.
First, it depends on Your needs. But You can do it like this: Juste don´t use RadioGroup, instead use two LinearLayouts:
<LinearLayoutLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="1">
<RadioButton android:id="#+id/btn1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<RadioButton android:id="#+id/btn2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayoutLayout>
<LinearLayoutLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="1">
<RadioButton android:id="#+id/btn3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
<RadioButton android:id="#+id/btn4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayoutLayout>
Then You can refer it programatically and deselect all other buttons, if one is pressed:
yourFirstRadioButton.setOnClickListener(new OnClickListener(){
#Override
public void onClick(View view){
YourSecondRadioButton.setChecked(false);
YourThirdRadiobutton.setChecked(false);
YourFourthRadioButton.setChecked(false);
}
});
You have to do this for all Your radio buttons. This is just a simple example, You can do it in a better way, for example with a for loop. For example, after creating RadioButtons, initialize a RadioButtons Array:
private RadioButton[] radioButtons;
initialize after initialize all radioButtons:
radioButtons = {radioButton1,radioButton2,radioButton3,radioButton4};
And the, make a setSelected(RadioButton button) method:
private void setSelected(RadioButton button){
for(int i=0;i<radioButtons.length;i++){
if(radioButtons[i]!=button){
radioButtons[i].setChecked(false);
}
}
}
and call this in Your onClick():
yourFirstRadioButton.setOnClickListener(new OnClickListener(){
#Override
public void onClick(View view){
setSelected(yourFirstRadioButton);
}
});
It´s possible that I have some little wrong coding here, because I can´t test it at the moment, have no IDE here. But just give it a try and come back if it doesn´t work.
1.remove radiogroup.
2.take parent layout as relative
3.take 4 radio button as required
4.write onclicklistener for all radio button
5.In radio button-1 onclicklistener event disable other button and do that for other(set check for particular button and for other set unchecked)
Remove Radio Group, implements onClickListener for RadioButtons and maintain the active Radio Button Id. Like:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RadioButton
android:id="#+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClickButton" />
<RadioButton
android:id="#+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/btn1"
android:onClick="onClickButton" />
<RadioButton
android:id="#+id/btn3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/btn1"
android:onClick="onClickButton" />
<RadioButton
android:id="#+id/btn4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/btn2"
android:layout_toRightOf="#id/btn3"
android:onClick="onClickButton" />
</RelativeLayout>
Then, In ur activity implements "onClickButton" method mentioned to the OnClick attribute of RadioButtons:
private RadioButton checkedRadioButton;
// OnClick listener for Radio Buttons
public void onClickButton(View view) {
RadioButton radioButton = (RadioButton) view;
if (checkedRadioButton != null) {
checkedRadioButton.setChecked(false);
}
radioButton.setChecked(true);
checkedRadioButton = radioButton;
}
// Get the Active radio button ID
private int getCheckedRadiButtonId() {
if (checkedRadioButton != null) {
return checkedRadioButton.getId();
}
return 0;
}
U can get the current active radioButton Id using getCheckedRadiButtonId.
I have created radio group with custom layout i.e. custom button.
<?xml version="1.0" encoding="utf-8"?>
<RadioGroup
android:id="#+id/radio_group_rating"
android:layout_width="match_parent"
android:layout_height="150dp"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="3" >
<RadioButton
android:id="#+id/radio_platinum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="#null"
android:clickable="true"
android:drawablePadding="10dp"
android:drawableTop="#drawable/star_small_dis"
android:gravity="center"
android:text="#string/platinum" />
<RadioButton
android:id="#+id/radio_gold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="#null"
android:clickable="true"
android:drawablePadding="10dp"
android:drawableTop="#drawable/star_small_dis"
android:gravity="center"
android:text="#string/gold" />
<RadioButton
android:id="#+id/radio_silver"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="#null"
android:clickable="true"
android:drawablePadding="10dp"
android:drawableTop="#drawable/star_small_dis"
android:gravity="center"
android:text="#string/silver" />
</LinearLayout>
</RadioGroup>
<Button
android:id="#+id/btn_submit"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="#id/radio_group_rating"
android:text="#string/submit" />
And in Activity, I have below code,
final Dialog dialog = new Dialog(mActivity);
dialog.setContentView(R.layout.rating_cust_dialog_layout);
radioGroupRating = (RadioGroup) dialog.findViewById(R.id.radio_group_rating);
Button btnSubmit = (Button) dialog.findViewById(R.id.btn_submit);
btnSubmit.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
int selectedRadioId = radioGroupRating.getCheckedRadioButtonId();
View radioButton = radioGroupRating.findViewById(selectedRadioId);
Integer selctedPosition = radioGroupRating.indexOfChild(radioButton);
dialog.dismiss();
}
});
dialog.show();
My issue is radio buttons are not getting clicked. I thought it's because of android:button="#null" So I replaced it with android:button="#drawable/star_dis" but still not getting clicked.
Its the android:button="#null", please remove it from the xml file completely.
Try using this simple xml layout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RadioGroup
android:id="#+id/radio_group_rating"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RadioButton
android:id="#+id/radio_platinum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="platinum" />
<RadioButton
android:id="#+id/radio_gold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="gold" />
<RadioButton
android:id="#+id/radio_silver"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="silver" />
</RadioGroup>
<Button
android:id="#+id/btn_submit"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="submit" />
</LinearLayout>
Only difference to my code is that I don't put clickable="true" in xml, if RadioGroup handles touch event by itself to manage child radio buttons you should remove that attribute as clickable is generally set to true automatically when you set an OnClickListener.
I am having an issue registering a call when a button is clicked.
I have 2 EditTexts, one Button and one CheckBox. I would like to get the onClick() function called when the Button is pressed. Unfortunately, it only happens when the CheckBox is pressed, but it's not the correct ID so I am confused.
Here is the java code:
Button connect = (Button) findViewById(R.id.connectToServer);
connect.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
....
}
As you can see, I look for the id "connectToServer".
This is my .xml file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="#ffb6b6b6"
android:textColor="#ffffffff" android:padding="2px" android:text="Settings" />
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:padding="13px">
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:textSize="25px"
android:textColor="#ffffffff" android:text="Set server settings" />
<TableLayout android:layout_marginTop="10px"
android:stretchColumns="1" android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow>
<TextView android:text="IP address:" />
<EditText android:id="#+id/serverIP" android:maxLength="15" />
</TableRow>
<TableRow>
<TextView android:layout_marginTop="4px" android:text="Port:" />
<EditText android:id="#+id/serverPort" android:maxLength="15" />
</TableRow>
</TableLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_marginTop="10px" android:orientation="horizontal"
android:layout_height="fill_parent" android:gravity="center">
<Button android:text="Connect" android:id="#+id/connectToServer"
android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
</LinearLayout>
</LinearLayout>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="#ffb6b6b6"
android:textColor="#ffffffff" android:padding="2px"
android:layout_marginTop="10px" android:text="Availability" />
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:padding="13px">
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:textSize="25px"
android:textColor="#ffffffff" android:text="Set device available" />
<TableLayout android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1">
<TableRow>
<TextView android:layout_marginTop="10px"
android:layout_width="wrap_content" android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Uncheck to disallow anyone from\nremotely connecting to the device." />
<CheckBox android:id="#+id/checkbox" android:gravity="right"
android:checked="true" android:layout_weight="1"
android:layout_width="wrap_content" android:layout_height="fill_parent" />
</TableRow>
</TableLayout>
</LinearLayout>
</LinearLayout>
The important line I believe would be this:
<Button android:text="Connect" android:id="#+id/connectToServer"
android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
but the code only gets called when the CheckBox button is checked or unchecked. I am not sure why that is.
Thank you very much!
Try this,
Button connect = (Button) findViewById(R.id.connectToServer);
connect.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
}
});
there is much simpler way to handle click events
1) add android:onClick to assign the function like that
<Button android:id="#+id/connectToServer"
android:text="Connect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick_connectToServer"
/>
2) implement onClick inside your activity
public void onClick_connectToServer(View v) {
String tag = "" + v.getTag();
// here you can handle the action
}
in this case, you don't need to add onClickListener explicitly.
Social Coding # AspiroTV
I ran into the same problem. I changed the button order within XML and the onClickListener started calling the wrong event. The view looked correct from the device but the View IDs in R.java were incorrect.
Using Eclipse: I simply did Project->Clean...
The event listeners started working correctly.