findViewById return null only for one element

I have been reading several posts about it but the common solutions did not work in my case (or maybe I didn’t understand how to implement them because I am learning)…

The problem is that only two of the three values that I enter arrive correctly, the “email” always comes out null (I can see it when debugging) and I really don’t understand why only that flaw.

This is the activity_sign_in.xml:

...
<EditText
    android:id="@+id/SignName"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:hint="Nombre"
    android:layout_margin="20dp" />

<EditText
    android:id="@+id/SignEmail"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:hint="Correo"
    android:layout_margin="20dp"
    android:inputType="textEmailAddress" />

<EditText
    android:id="@+id/SignPass"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:hint="Contraseña"
    android:layout_margin="20dp"
    android:inputType="textPassword" />
...

And this is de SignIn.java

...
public class SignIn extends AppCompatActivity implements View.OnClickListener {

    EditText name, email, pass;
    Button saveButton;
    String username, mail, password;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sign_in);

        name = (EditText)findViewById(R.id.SignName);
        email = (EditText)findViewById(R.id.SignEmail); //This one always comes null
        pass = (EditText)findViewById(R.id.SignPass);
        saveButton = (Button)findViewById(R.id.SaveButton);

        saveButton.setOnClickListener(this);
    }
}
@Override
public void onClick(View v) {

    username = name.getText().toString(); //It's Ok
    mail = email.getText().toString(); //It's null
    password = pass.getText().toString(); //It's Ok
}

Regards!

Answer

I see no problem in the String maill = email.getText().toString() code. Though I want to point out that if you are declaring the String maill inside onClick method and calling it from some other method to print log, you might get a null value. I suggest declaring the String as global variable for your activity and try again.

public class SignIn extends AppCompatActivity implements View.OnClickListener {

EditText name, email, pass;
Button saveButton;
String maill,pwd;//Declare your strings here.

@Override
protected void onCreate(Bundle savedInstanceState){......}