Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I Pass two value in spinner one for ID and second for Title #12

Closed
mukesh-makavana opened this issue Jan 29, 2018 · 1 comment
Closed

Comments

@mukesh-makavana
Copy link

Hello Md Farhan,

I want to create app using your spinner in this app i want to show item title but i want to get two value id and title (item name) when i click on spinner item.

so please tell me how can i set custom ID and Title With Array List and get access it on click event.

@devsarfo
Copy link

Hi, I think I have a better solution for you
Declare two variables:
ArrayList ids;
ArrayList labels;

And then the object variable list
List suppliers;

for (Supplier supplier : suppliers) {
ids.add(supplier.getId().toString());
labels.add(supplier.getCompanyName());
}

spdItems.bindOnSpinerListener(new OnSpinerItemClick() {
@OverRide
public void onClick(String item, int position) {
//TO get id use the position
String id = ids.get(position);
String label = lables.get(position);
}
});

hope this works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants