Actually I'm trying to create an app it has Navigation Drawer and Google Sign In for which I also need to add auth code every where.
I wanted to know is there any way of putting all the navigation drawer code somewhere else (say in different class file) and then calling the code in the different activities?
As copy pasting the same thing again and again is sometime irritating.
Please help.
Thanks.
You can do it very simply.
But this is not a good approach
that you sign in with google
in every item of navigation drawer. If you sign in user on first screen
and then access that user
wherever you want without doing unwanted things in code.
But Still you want solution
Solution
you should make a google sign in method
in a class with parameter Context. Access it wherever you want from that class provides sign in method
.
Library
you can do it very simply by library from github:
The process is simple, create classes and pass the data as a parameter
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.