opened
fgagneten
username_0
I want to get the identifier of the current user.
I have:

      .withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() {
                        @Override
                        public boolean onProfileChanged(View view, IProfile profile, boolean current) {
                            if (profile instanceof IDrawerItem && profile.getIdentifier() == R.id.logout) {
                                //
                                // Here I want to get the identifier of the current user logged in
                                //
                            }
                            return false;
                        }
                    })
                    .build();

When the user click logout I want to get the current user identifier so I can remove it from my storage.
Thanks a lot!
Get current user identifier onProfileChanged
issue
created
mikepenz
username_1
@username_0 simply keep track of the profileChange events. You can easily store the current user somewhere in a variable on your side. the new current user would already be changed at the time when the event is fired
comment
closed
mikepenz
username_1
issue
created
mikepenz
username_1
```java
.withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() {
                    long previousSelectedIdentifier = -1L;
                    @Override
                    public boolean onProfileChanged(View view, IProfile profile, boolean current) {
                        if (profile instanceof IDrawerItem && profile.getIdentifier() == R.id.logout) {
                            //
                            // Here I want to get the identifier of the current user logged in
                            //
                        } else {
                              previousSelectedIdentifier = profile.getIdentifier();
                       }
                        return false;
                    }
                })
```

something like that would already work. you have to anyways also set the initial profile so this should also fire the listener and set the previous identifier
comment