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 6853755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:32:58+00:00 2026-05-27T01:32:58+00:00

I have two textbox and a checkmebox. But when i type my username and

  • 0

I have two textbox and a checkmebox. But when i type my username and password and tick on the checkmebox, exit the application and go back again it doesn’t appear. Why?

// Get reference to UI elements
        txtLogin = (EditText) findViewById(R.id.txtLogin);
        txtPassword = (EditText) findViewById(R.id.txtPassword);

        SharedPreferences pref = getSharedPreferences(PREFS_NAME,MODE_PRIVATE);   
        String username = pref.getString(PREF_USERNAME, null);
        String password = pref.getString(PREF_PASSWORD, null);

        if (username == null || password == null) {
            //Prompt for username and password
            Toast.makeText(getBaseContext(),
                    "HI",
                    Toast.LENGTH_SHORT).show();
        }


        // Remember me function
        CheckBox cbRemember = (CheckBox) findViewById(R.id.chkRememberPassword);
        if (cbRemember.isChecked()) {

            getSharedPreferences(PREFS_NAME,MODE_PRIVATE)
            .edit()
            .putString(PREF_USERNAME, txtLogin.toString())
            .putString(PREF_PASSWORD, txtPassword.toString())
            .commit();
        }
  • 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-27T01:32:58+00:00Added an answer on May 27, 2026 at 1:32 am

    First: You should not be using txtLogin.toString(); but rather use txtLogin.getText(); to get the values from the editText controls.

    Are you sure the code that saves the preferences is invoked?

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

Sidebar

Related Questions

I have two CheckBoxes and a TextBox. I want to TextBox to have IsEnabled=False
I have two div's one has textbox in it and other just plain text.
I have two user controls, in one of them I have a textbox, i
I am attaching an asp.net textbox image I want my textbox should have two
I have a webpage where there are two buttons and a textbox. When the
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two
I have two textbox called BIRTH & EMAIL , and I must test in
I have two textbox in a page each uses ASP.Net Ajax Autocompleteextender control. asp:TextBox
i have an aspx page and two textbox and a button on it.I want
I have two text boxes: A and B using Html.textboxfor . TextBox 'A' is

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.