// chipGroup에서 선택된 chip의 text 값 얻는 방법
List<Integer> a = chipGroup.getCheckedChipIds();
Log.i(TAG, "chipGroup.getCheckedChipIds() = " + chipGroup.getCheckedChipIds());
Log.i(TAG, "a.get(0) = " + a.get(0));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < a.size(); i++){
Chip r = (Chip) chipGroup.getChildAt(chipGroup.indexOfChild(chipGroup.findViewById(a.get(i))));
String selectedText = r.getText().toString();
sb.append(selectedText+"-");
Log.i(TAG, "a.get("+i+") = " + a.get(i));
Log.i(TAG, "selectedText = " + selectedText);
}
String result = sb.toString();
result = result.substring(0, result.length() -1);
Log.i(TAG, "result = " + result);
'개발공부 > Java & 안드로이드' 카테고리의 다른 글
[안드로이드] Volley로 여러 개 파일 보낼 때 (Multipart Request) (0) | 2022.09.21 |
---|---|
[안드로이드] getAppKeyHash() (0) | 2022.09.19 |
[안드로이드] 하단 바 메뉴(Bottom Navigation) 타이틀 항시 표시하는 법 (0) | 2022.07.18 |
[안드로이드] 액션바(Action Bar) 한번에 없애는 법 (0) | 2022.07.17 |
[안드로이드] How to underline TextView in Android (TextView 밑줄 긋는 법) (0) | 2022.07.16 |