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

Unable to update counter value #21

Closed
saintjab opened this issue Nov 3, 2018 · 5 comments
Closed

Unable to update counter value #21

saintjab opened this issue Nov 3, 2018 · 5 comments
Assignees
Labels

Comments

@saintjab
Copy link

saintjab commented Nov 3, 2018

Great library. I am trying to update the value of the counter but can only work on the initial setCount(), subsequent ones are not updating the value. I am currently setting the value at the onCreateView of a fragment where I can increase/decrease the value. However when I come back to the same fragment the new setCount() isn't working because the fragment never got destroyed though onCreateView is called and getCount() shows the value I set but doesn't update the value with the set value. Any advice why this is happening?

@andremion
Copy link
Owner

Hey, thank you for using it.
Could you please add some code snippets of how you are using it so I can try to reproduce and understand better the scenario.

@andremion andremion self-assigned this Nov 9, 2018
@saintjab
Copy link
Author

Hey, sorry for the delay. I have attached a screenshot on the issue. I am using increase() and decrease() methods which work successfully to increase/ decrease the value of the count. However as shown in the highlighted screenshot, though the fab.setCount() method seems to work, the fab view isn't updating the count from 3 to new value 2
screenshot
.

@andremion
Copy link
Owner

I don't know if I got your question.
But you said that the "issue" occurs when you come back to that fragment where you are setting the count value in onCreateView method.
That means that your fragment is just resuming and you need to chose another lifecycle method to set the count, like onResume for example.
This could occurs with any view that you manipulate outside your fragment's view. Be careful with that.

@saintjab
Copy link
Author

saintjab commented Nov 20, 2018

@andremion. I moved the update to the onResume() and that solved the issue. Thanks for the pointer. You can close this now.

@andremion
Copy link
Owner

You're welcome!

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

No branches or pull requests

2 participants