baoyongzhang / baoyongzhang/SwipeMenuListView

Change Item Icon when it's clicked

Open
#41 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.5k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Hi! I want to know how to change the icon when the item is clicked. I use 2 different items, so in the next code I access to the second that contains an icon, but it doesn't work:
productsList.setOnMenuItemClickListener(new SwipeMenuListView.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(int position, SwipeMenu menu, int index) {

```
menu.getMenuItem(1).setIcon(getResources().getDrawable(R.drawable.list_added,getApplicationContext().getTheme()));

return false;
}
});
```

Thanks a lot!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the SwipeMenuListView.OnMenuItemClickListener entry point and the supplied menu.getMenuItem(1).setIcon(...) call. Reproduce the listener with the two menu items, then trace the menu item implementation to determine why the icon is not updated; done means the second item's icon changes after it is clicked.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.