-
Notifications
You must be signed in to change notification settings - Fork 433
Accounts
A collection of user data.
This library not implements an Android Account, it allows only to set user data in your navigation drawer.
NOTE: if you want to add an account asynchronously, please see the FAQ related
MaterialAccount account = new MaterialAccount(this.getResources(),"Name and Surname","subtitle or email",R.drawable.photo, R.drawable.background);
this.addAccount(account);
You can add how many account you want, but It is suggested to have at least one account setted into the init() method when the drawer is created.
For other constructor, check the list below:
public MaterialAccount(Resources resources,String title, String subTitle, int photo,Bitmap background)
public MaterialAccount(Resources resources,String title, String subTitle, int photo,int background)
public MaterialAccount(Resources resources,String title, String subTitle, Bitmap photo, int background)
public MaterialAccount(Resources resources,String title, String subTitle, Bitmap photo, Bitmap background)
Change your account information, then call this MaterialNavigationDrawer activity method:
notifyAccountDataChanged();
N.B. If you are in another thread, make sure to call this method from the main thread calling runOnUiThread()
If you want to know when the user switch his account with another, or when user clicks on his current account, you should implement an MaterialAccountListener
for reaching these events.
You can attach this listener in your init method with the following code:
this.setAccountListener(this); // or new MaterialAccountListener() {}