Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7751355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:31:38+00:00 2026-06-01T11:31:38+00:00

Lets say you have a web app related Android app that requires the user

  • 0

Lets say you have a web app related Android app that requires the user to login in order to use it. The user logs in, in the Login screen activity and then proceeds to other activities. Each time the user starts an Activity, the app checks his login credentials again (The credentials are stored in a central database somewhere).

As the user jumps from one activity to another, lets pretend that the user’s login credentials are revoked from the service. The next time the user visits an Activity, the app will see that he no longer has access. The app should now kick the user back to the login screen Activity.

But since there is already a stack of Activities that the app has created as the user used the app, how do you get the login screen. Do you kill/destroy all Activities until you reach the login screen Activity (which should be the Activity at the bottom of the stack for the app)?

Or do you start a new Login Screen Activity and go straight to that?

Or should I call the Login Screen Activity with the FLAG_ACTIVITY_CLEAR_TOP passed through the intent?

After the user is able to login the second time (lets say he got his credentials reinstated), if the Activity is now the only one in the stack, pressing the back button will take him out of the App, as opposed to going back to what he was doing before having his credentials revoked. What is the best approach to this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:31:39+00:00Added an answer on June 1, 2026 at 11:31 am

    My personal choice is to set up all of your activities (besides the login activity, of course) to check the user’s credentials in onResume() (I do this by inheritance, with all of my Activities inheriting from an abstract AuthorizedActivity, but do what works for you). If the user does not have credentials (either because they don’t have them or they’ve been revoked) then I startActivityForResult() the login activity. If the LoginActivity returns a valid user, all is well. If the user is a valid but different one from who was logged in before, I take them to my root activity with FLAG_ACTIVITY_CLEAR_TOP. pressing the back button from the loginActivity does them no good, as the app will bounce them straight to home.

    I find that the approach gives me flexibility in deciding when and how I will check/revoke credentials, even if they leave (briefly) the application.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When creating a web application, and lets say you have a User object denoting
I have an web app running on lets say following IP : 10.101.10.101 .
Let's say I write an app that displays restaurant menus and lets a user
I have a web app that has to do something every, let's say first
Let's say you have a typical web app and with a file configuration.whatever. Every
Let's say I have a class in my web app called class Foo. It
Let's say I have a list of categories for navigation on a web app.
Lets say I have several web sites on my web server, all as applications
I have an echo web service running on lets say http://localhost:8080/axis2/services/Service1 . This service
Let's say I have a web page that currently accepts a single ID value

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.