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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:55:20+00:00 2026-05-29T09:55:20+00:00

public void createpass() { //set up dialog final Dialog dialog = new Dialog(App.this); dialog.setContentView(R.layout.createpass);

  • 0
public void createpass() {
//set up dialog
final Dialog dialog = new Dialog(App.this);
dialog.setContentView(R.layout.createpass);
dialog.setTitle("Set Password");
dialog.setCancelable(false);
//there are a lot of settings, for dialog, check them all out!

//set up text
final EditText text = (EditText) dialog.findViewById(R.id.editText1);
text.setText("");
//set up text
final EditText text2 = (EditText) dialog.findViewById(R.id.editText2);
text2.setText("");



//set up button
Button button = (Button) dialog.findViewById(R.id.Button01);
button.setOnClickListener(new OnClickListener() {
@Override
    public void onClick(View v) {

    String createpass_password = text.getText().toString().trim();
    String createpass_password2 = text2.getText().toString().trim();


    try
    {
        if(createpass_password == createpass_password2)
        {
            FileWriter fstream = new FileWriter("/data/data/folder.hide.alexander.fuchs/password.db");
            BufferedWriter out = new BufferedWriter(fstream);
            out.write(createpass_password);
            //Close the output stream
            out.close();    
        dialog.dismiss();
        }
        else
        {
            toaster("Passwords are not matching !");
            text.setText("");
            text2.setText("");
        }
    }
    catch(Exception x)
    {       
        String ErrorMessage = x.getMessage();
        toaster("Error");
        finish();
    }

}
});
//now that the dialog is set up, it's time to show it   

    dialog.show();

}

I try to access the value of EditText,
they should be equal
but they aren’t

I try to make password dialog
and the password is verified verify via “if else”

the dialog appears correctly but when i enter the same values
the if structure reports them as not equal

  • 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-29T09:55:21+00:00Added an answer on May 29, 2026 at 9:55 am

    You have to use "String".equals("String") to test String content.

    == tests if the objects references are equal.

    So in your code you have to do:

    if (createpass_password.equals(createpass_password2)) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public void myMethod { MyProgessBarFrame progFrame = new MyProgressBarFrame(); // this is a JFrame
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.full_image); ImageView image = (ImageView) findViewById(R.id.imageView1); Bitmap bMap
public void onBackPressed() { Intent setIntent = new Intent(this,xxxxx.class); startActivity(setIntent); return; } I call
public void EncryptFile() { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = JPEG Files (*.jpeg)|*.jpeg|PNG
public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.detail); TextView forgot_pswrd = (TextView) findViewById(R.id.textView1); LinearLayout.LayoutParams llp
public void test() { List<int> list = new List<int>(); list.Add(1); list.Add(2); list.Add(3); for (int
public void MyTest() { bool eventFinished = false; myEventRaiser.OnEvent += delegate { doStuff(); eventFinished
public void Save() { XmlSerializer Serializer = new XmlSerializer(typeof(DatabaseInformation)); /* A first chance exception
[TestMethod] public void Memory() { var wr = new WeakReference(aaabbb); Assert.IsTrue(wr.IsAlive); GC.Collect(); GC.Collect(); GC.Collect();
[TestInitialize()] public void MyTestInitialize() { XmlTextWriter writer = new XmlTextWriter(DataFile.xml, Encoding.UTF8); writer.Formatting = Formatting.Indented;

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.