Issue
I am using switch component inside my list item. But no matter I enable the switch or not. It's returning false.
group_select.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (group_select.isChecked()){
Toast.makeText(context, "Checked at "+position, Toast.LENGTH_SHORT).show();
}
else if (!group_select.isChecked()){
Toast.makeText(context, "Unchecked at "+position, Toast.LENGTH_SHORT).show();
}
}
});
Thanx for the help....
Solution
ToggleButton toggle = (ToggleButton) findViewById(R.id.togglebutton);
toggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
// The toggle is enabled
} else {
// The toggle is disabled
}
} });
Answered By - Mohammad Salem
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.