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

Cannot change image button image on clicking it #63

Open
sushilblore opened this issue Jul 3, 2015 · 1 comment
Open

Cannot change image button image on clicking it #63

sushilblore opened this issue Jul 3, 2015 · 1 comment

Comments

@sushilblore
Copy link

Hi,

I want to change the image of the imagebutton when I click on it (The image button of camera and people which are placed below picture).

I have added the imagebutton listener in SimpleCardStackAdapter.java:

cardHolder.mLikeButton.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View v) {
Log.i("Sushil", "clicked like button!!!!!");
updateHeartButton(true);
}
});

When I click on the button, my listener is called and from inside I call a method to update the image of button:

private void updateHeartButton(boolean animated) {
cardHolder.mLikeButton.setImageResource(R.drawable.ic_heart_red);
}

But the imagebutton does not get updated with new image. can someone help me.

Thank You

@lmouhib
Copy link

lmouhib commented Nov 19, 2015

I think the problem is that the view is already generated after it goes through the simple cardstackadapter, what you should do is change the code bellow and adapt it to the button, so it can be changed dynamically

((TextView) convertView.findViewById(R.id.description)).setText(model.getDescription());

Could you share your code?

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

2 participants