I'm building an Android app where different "types" of users can log in - lets say User and Admin are the two roles (there could be more than two). User can access some views in the app, by pressing buttons that are presented to it. Admin can access those same views but more, via buttons exposed only to the admin. Furthermore, user flows for the different roles might be different. User could go from Activity A -> B -> C while Admin can go from A -> C. Currently, I'm handling this with switch and if statements showing and hiding buttons and views, but I can tell this can quickly get messy when adding more than a couple roles. Of course, permissions are protected on the server side so I'm just worried about showing the relevant user, relevant options for navigation.

How do Android apps manage multiple roles that can log into the client? Are there any frameworks / clients that simplify something like this? Are there some OOP best practices I can keep in mind?

EDIT: Got a downvote and a close vote not one second after I posted this. Not sure if someone just read the title and deemed this question unfit. A comment explaining why will help me reform my question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.