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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:17:08+00:00 2026-06-15T12:17:08+00:00

sir, how do i save the changes made in my change password activity if

  • 0

sir, how do i save the changes made in my change password activity if i changed to another activity. at first, i’ve tried to just use a variable to save the values, but if i return to other activity all changes made comes back to normal. i’ve tried to use arraylist but it’s the same. can you teach me other methods of creating a change password option. thanks for help in advance.

public class ChangePassword extends Activity {
/** Called when the activity is first created. */
EditText enterPassword, enterNewPassword;
String defaultPassword = "1234";
ArrayList<String> newPasswordArray = new ArrayList<String>();
ArrayList<String> currentPasswordArray = new ArrayList<String>();
String newPassword;
String currentPassword;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.changepassword);
    Button save = (Button)findViewById(R.id.btnSaveSettings);
    enterPassword = (EditText)findViewById(R.id.etEnterPassword);
    enterNewPassword = (EditText)findViewById(R.id.etNewPassword);
    currentPasswordArray.add("1234");
    for(String s: newPasswordArray)
    {
        newPassword = s;
    }
    for(String s: currentPasswordArray)
    {
        currentPassword = s;
    }
    save.setOnClickListener(new OnClickListener()
    {
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            try
            {
                //get string from arraylist
                for(String s: newPasswordArray)
                {
                    newPassword = s;
                }
                for(String s: currentPasswordArray)
                {
                    currentPassword = s;
                }

                //test password
                if(enterPassword.getText().toString().equals(currentPassword))
                {
                    if(enterNewPassword != null)
                    {
                        String newPass = setNewPassword(enterNewPassword.getText().toString());
                        setCurrentPassword(newPass);
                        Toast.makeText(getApplicationContext(), "Save Success", Toast.LENGTH_LONG).show();
                    }
                    else
                    {
                        Toast.makeText(getApplicationContext(), "Please fill up all fields.", Toast.LENGTH_LONG).show();
                    }
                }
                else
                {
                    Toast.makeText(getApplicationContext(), "Current password, unmatched.", Toast.LENGTH_LONG).show();
                }

            }
            catch(Exception e)
            {
                e.printStackTrace();
                Toast.makeText(getApplicationContext(), "Save failed", Toast.LENGTH_LONG).show();
            }
        }
    });
}//oncreate()

public String setNewPassword(String pass)
{
    String returnPass = "";
    newPasswordArray.clear();
    newPasswordArray.add(pass);
    for(String s : newPasswordArray)
    {
        returnPass = s;
    }
    return returnPass;
}//setNewPassword()

public String getPassword()
{
    return newPassword;
}//getPassword
public void setCurrentPassword(String newpass)
{
    currentPasswordArray.clear();
    currentPasswordArray.add(newpass);
}//setCurrentPassword

}

  • 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-15T12:17:10+00:00Added an answer on June 15, 2026 at 12:17 pm

    You must use one of the 3 ways that Android platform provides, to save your data:

    1. SharedPreferences
    2. SQLiteDatabase
    3. Files

    If you just want to save and resume again.

    But if you just want to save the instance of your activity then you can just override the appropriate methods.

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

Sidebar

Related Questions

Update Sir this is current code of my web page.I made changes according to
Hello Sir i want send list of data to php server i use following
Sir, I am developing an application in which i am to save some information
Sir, when I change some code and test my App by pressing run or
fname = dir('*sir'); [tmp, head] = loadsir(fname(1).name); dayh99 = zeros(length(fname),size(tmp,1),size(tmp,2)); %41-100,1360,3600 % use temporary
hello sir in login page i am validating username and password from server database.
Sir, these days i am improving my recursion skills but i am stuck in
Sir, I am doing the task on fetching the contents from the xml file.I
Sir, I am having some problem regarding database in SQL Server. My project is
Respected sir/madam, I have a fortran exe which takes a input file and produces

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.