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

How do I create a Log Out button?

So I am using this course to create an android app that uses Firebase to store user login data. I am also planning to use the messaging side of this course in my app.

I need to be able to log out and repeatedly log back in with different logins.

I have created a log out option in an options menu that will take me from MessagingActivity to LoginActivity. But this then loops back and loads up MessagingActivity as I am being flagged as already being logged in.

How do I set onClickListener or onOptionsItemSelected to clear the cached login info?