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

  • SEARCH
  • Home
  • 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 6795007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:17:27+00:00 2026-05-26T18:17:27+00:00

I have been searching on the Internet about how to create a Session in

  • 0

I have been searching on the Internet about how to create a Session in an Android application. I found this and it certainly helped me in a part of my project.

At present, I have a similar situation where in I have a Login application that asks the user to enter the username and password. On click of the submit button I create and initialize my Session object.

The problem I am facing now is the fact that I want to know whether I can use this object in various activities apart from my Login application activity. I also want to know that if the Session object contain user credentials , can it be send via a web service and stored in a remote database?

  • 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-05-26T18:17:28+00:00Added an answer on May 26, 2026 at 6:17 pm

    Create a class that extends Application (don’t forget to update your manifest file) and add to it the required fields (username, password and so on). This class will be available to all your activities. You can find a detailed explanation here.

    Later edit:

    Let’s say you have a Session class with username as a field.

    class Session {
        public String username = "";
    }
    

    Next, extend the Application:

    class App extends Application {
        Session session = new Session();
    
        public String getUsername() {
            return session.username;
        }
    
        public void setUsername(String username) {
            session.username = username;
        }
    }
    

    Now, when you want to access the username, you can do it from any activity:

    App app = (App) getApplication();
    String username = app.getUsername();
    if (username.equals("")) {
        // the user is not logged in, do something
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been searching the internet for an answer on this registry search issue.
I have been searching round the internet for days on this matter but I
I've been searching in the Internet about this error with no result. I'm lost
I have been searching the internet for days trying to solve this problem. I
I've been searching on the internet for some useful and clear information about this,
I have been searching the Internet for a solution but not found one, hopefully
I have been searching the internet wildly for an answer to this question. We
I have been searching for this all over the internet, this site claims that
I have been searching for info on this to no avail. The context of
I have been searching forever. Sorry, I am pretty desperate at this point so

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.