Reputation: 741
I am working on an application where I need to show multiple chips from the ArrayList.
Please consider the following code:
<android.support.design.chip.ChipGroup
android:id="@+id/chipGroupProfCreds"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="@dimen/_50sdp"/>
Java
Chip lChip = new Chip(SignUpNextActivity.this);
for (int i = 0; i < Constant.arraylistselectedproffesionalcredential.size(); i++) {
lChip.setText(Constant.arraylistselectedproffesionalcredential.get(i).toString());
binding.chipGroupProfCreds.addView(lChip);
}
Can you please let me know how can I add the whole Constant.arraylistselectedproffesionalcredential
to this ChipGroup.
Upvotes: 3
Views: 416
Reputation: 363895
You can use something like:
for (String chipText: Constant.arraylistselectedproffesionalcredential){
Chip lChip = new Chip(this);
lChip.setText(chipText);
....
chipGroup.addView(lChip);
}
Upvotes: 2