roughike / SwipeSelector

A nicer-looking, more intuitive and highly customizable alternative for radio buttons and dropdowns for Android.
Apache License 2.0
1.09k stars 154 forks source link

Dynamically add SwipeItems #32

Open justrelax19 opened 7 years ago

justrelax19 commented 7 years ago

Suppose we have 10 elements in the array. So is there any way to add 10 SwipeItems with the Java code i.e to dynamically add 10 swipeitems ??

nickstamp93 commented 6 years ago

You can achieve this with the following code. Note that lists wont work, only arrays:

SwipeItem[] swipeItems = new SwipeItem[10];
for (int i = 0; i < 10; i++) {
    SwipeItem item = new SwipeItem( object , title, desc);
    swipeItems[i] = item;
}
swipeSelector.setItems(swipeItems);
dpather commented 6 years ago

it doesn't update the View Title values when called for the 2nd time. Any help?

shohoku6 commented 6 years ago

no update from dpather Question? i have same issue as dpather, i hope there is an answer about this issue.