nex3z / ToggleButtonGroup

A group of flowable toggle buttons, with multiple / single selection support and button customization.
Apache License 2.0
421 stars 48 forks source link

get text in cicrularToggle #47

Closed zoro238 closed 5 years ago

zoro238 commented 5 years ago

In a file xml I put text for each one single so how does the contents of the text in the selected file give me the programmatically

nex3z commented 5 years ago

Get text on selected button in SingleSelectToggleGroup:

SingleSelectToggleGroup single = findViewById(R.id.group_choices);
int checkedId = single.getCheckedId();
CircularToggle toggle = single.findViewById(checkedId);
Log.v(LOG_TAG, "Selected text: " + toggle.getText());

Get text on selected button in MultiSelectToggleGroup:

MultiSelectToggleGroup multi = findViewById(R.id.group_weekdays);
for (int checkedId : multi.getCheckedIds()) {
    CircularToggle toggle = multi.findViewById(checkedId);
    Log.v(LOG_TAG, "Selected text: " + toggle.getText());
}
zoro238 commented 5 years ago

thank you a lots my brother