Q: How to add code for forgot/reset password using Parse Android Java I am trying to set up a editText and Button to allow a user to reset their password via Parse. I've done some research and I keep coming back to the below example code out of the Parse docs. Am I supposed to replace "email@example.com" with a string made up of the current user? How is the best way to collect the current user and place in the parenthesis?
Parse.User.requestPasswordReset("email@example.com")
.then(() => {
  // Password reset request was sent successfully
}).catch((error) => {
  // Show the error message somewhere
  alert("Error: " + error.code + " " + error.message);
});

I am trying capture the users email in an emailEditText and insert it into the reset method. I keep getting an error regarding the ParseUser line of code.  I would appreciate any help you can give, thanks.
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.text.Editable android.widget.EditText.getText()' on a null object reference
        at com.example.AdventureGuideV2.ForgotPasswordActivity.onClick(ForgotPasswordActivity.java:42)

The line(42) the line containing the ParuseUser statement in my code snipet below:
public class ForgotPasswordActivity extends AppCompatActivity implements View.OnClickListener {
    EditText emailEditText;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_forgot_password);
        setTitle("Forgot Password");
    }

    @Override
    public void onClick(View view) {
        ParseUser.requestPasswordResetInBackground(emailEditText.getText().toString(), new RequestPasswordResetCallback() {
            @Override
            public void done(ParseException e) {
                if (e == null){
                    //send email
                }else {
                }
            }
        });
    }
}

Here is my Xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ForgotPasswordActivity">

    <EditText
        android:id="@+id/emailEditText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:ems="10"
        android:hint="@string/enteryouremail"
        android:inputType="textPersonName"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/button9"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="40dp"
        android:onClick="onClick"
        android:text="@string/submit"
        android:textAllCaps="false"
        android:textColor="@android:color/black"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/emailEditText" />
</androidx.constraintlayout.widget.ConstraintLayout>


A: The problem is that, you havent initialized your EditText properly, you missed the binding of it.
Try adding below code to your onCreate()
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_forgot_password);
        emailEditText = (EditText)findViewById(R.id.emailEditText);  //add here
        setTitle("Forgot Password");
    }

