Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Brad McConn
Brad McConn
2,785 Points

Should user data be stored in an android app?

I apologize if this question is subjective, but I'm not sure the best way to implement storing data about the user in a native app. For example, assume the app is consuming an API that uses OAuth 2.0. When the user logs in, the app receives a token to make future API calls. So if on the main page of the app you want to display the user's name, you can make a call to the API using the access token to get the user's info. But then if you navigate away from the main page and again want to display the user's name, should you make another call to the API? Or would it be better to store the user's info in an object and pass the object to the activity being created?

Maybe either is an option, or possibly there's a better way to do it, but I'm wondering what the best practice would be in this situation. Thanks for the feedback.