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

Update user profile image icon #1428

Closed
GutoMartins019 opened this issue Jul 29, 2016 · 4 comments
Closed

Update user profile image icon #1428

GutoMartins019 opened this issue Jul 29, 2016 · 4 comments
Assignees
Labels

Comments

@GutoMartins019
Copy link

GutoMartins019 commented Jul 29, 2016

Hi Mike,

First of all, thanks for your amazing job!
I am trying to use the method drawer.updateIcon(id, image in bitmap).
But the image don't update. I checked the image and is correct.

I tried update using the header object, but not work too.

There is any library that is necessary for this to work?

I can't find a solution.

Thanks again.

@mikepenz
Copy link
Owner

@GutoMartins019 you had an image prior to setting the bitmap?

And your item has an identifier set?

@mikepenz mikepenz self-assigned this Jul 29, 2016
@GutoMartins019
Copy link
Author

GutoMartins019 commented Jul 29, 2016

@mikepenz

Yes, i had a image before update, it was setted on create. My item have a identifier, a int value.

This is how i made:
new ProfileDrawerItem() .withName(user.getFirstName()) .withEmail(user.getEmail()) .withIcon(user.getProfileImageInBitmap()) .withIdentifier(3)

Added this ProfileDrawerItem to my AccountHeaderBuilder
Build my drawer on create activity:
drawer = new DrawerBuilder().withAccountHeader(headerResult)

And now i want to update the profile imagem like this:

if (drawer != null) { User user = new UserService().getUser(); drawer.updateIcon(3, new ImageHolder(user.getProfileImageInBitmap())); }

@mikepenz
Copy link
Owner

mikepenz commented Aug 1, 2016

@GutoMartins019 you are mixing drawer and header.

If you want to update a profile (an item of the AccountHeader) you have to use the AccountHeader specific methods to update it's elements.

Which would result in something like this, to update the icon:

profile5.withIcon(BitmapFactory.decodeResource(getResources(), R.drawable.leak_canary_icon));  
headerResult.updateProfile(profile5);

@mikepenz mikepenz closed this as completed Aug 1, 2016
@GutoMartins019
Copy link
Author

@mikepenz Thanks for help me!

Sorry for mixing things =/.

Now its working perfect!

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