Q: I cannot take a value from EditText and work with that value I can't solve the following problem for hours.
I try to get user-entered values from EditText so I can work with them.
public class Registrace extends AppCompatActivity implements View.OnClickListener {
private static final Pattern PASSWORD_PATTERN =
        Pattern.compile("^" + "(?=.*[0-9])" +
                "(?=.*[a-z])" + "(?=.*[A-Z])" + "(?=.*[@#$%^&+=])" + "(?=\\s+$)" + ".{6,}" + "$");


public EditText editPrijmeni, editJmeno, editEmail, editPwd, editPwd2;

public String Mess = null;

public String jmeno, prijmeni, email, heslo, heslo2;
 Button btn;


@Override
protected void onCreate(Bundle savedInstanceState) {


    super.onCreate(savedInstanceState);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    setContentView(R.layout.activity_registrace);

    TextView login = (TextView) findViewById(R.id.lnkLogin);
    login.setMovementMethod(LinkMovementMethod.getInstance());
    login.setOnClickListener(this);

    editJmeno = (EditText) findViewById(R.id.txtJmeno);
    jmeno = editJmeno.getText().toString().trim();

    editPrijmeni = (EditText) findViewById(R.id.txtPrijmeni);
    prijmeni = editPrijmeni.getEditableText().toString().trim();

    editEmail = (EditText) findViewById(R.id.txtEmail);
    email = editEmail.getEditableText().toString().trim();

    editPwd = (EditText) findViewById(R.id.txtPassword);
    heslo = editPwd.getEditableText().toString().trim();

    editPwd2 = (EditText) findViewById(R.id.txtPassword2);
    heslo2 = editPwd2.getEditableText().toString().trim();

    btn = (Button) findViewById(R.id.btnRegistrace);
    btn.setOnClickListener(this);

}

public boolean validujPrijmeni() {
     if(prijmeni.isEmpty()) {
         Mess = "Příjmení" + "\n";
         return false;


     } else {
         return true;
     }

}


@Override
public void onClick(View v) {


    switch (v.getId()) {
        case R.id.lnkLogin:
            Intent intent = new Intent(Registrace.this, Login.class);
            startActivity(intent);
            break;
        case R.id.btnRegistrace:
            Toast.makeText(this, "Registrace", Toast.LENGTH_SHORT).show();

            if(!prijmeni.isEmpty()) {
                Toast.makeText(this, prijmeni, Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(this, "Zadej příjmení", Toast.LENGTH_SHORT).show();
            }
            break;
    }

}
}

To make sure EditText values are stored correctly, I try to display them using Toast text.
But after filling in the value and pressing the button I still get the "else" block from the if statement for an empty EditText from the "switch". I'm not sure if the constructor declaration should be in the onCreate body or outside. 
Could anyone help me please ???
Thank you very much.
Here is layout.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">

<TextView
    android:id="@+id/loginscrn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_marginTop="30dp"
    android:text="Registrace"
    android:textSize="20dp"
    android:textStyle="bold" />

<TextView
    android:id="@+id/fstTxt"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="100dp"
    android:layout_marginTop="15dp"
    android:text="Příjmení" />
<EditText
    android:id="@+id/txtPrijmeni"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="100dp"
    android:ems="10" />
<TextView
    android:id="@+id/secTxt"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="100dp"
    android:layout_marginTop="15dp"
    android:text="Jméno"/>
<EditText
    android:id="@+id/txtJmeno"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="100dp"
    android:ems="10"/>
<TextView
    android:id="@+id/thirdTxt"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Email"
    android:layout_marginLeft="100dp" />
<EditText
    android:id="@+id/txtEmail"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="100dp"
    android:ems="10" />
<TextView
    android:id="@+id/fourTxt"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Heslo"
    android:layout_marginLeft="100dp" />
<EditText
    android:id="@+id/txtPassword"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="100dp"
    android:inputType="textPassword"
    android:ems="10" />

<TextView
    android:id="@+id/fiveTxt"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Heslo, znova pro kontrolu"
    android:layout_marginLeft="100dp" />
<EditText
    android:id="@+id/txtPassword2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="100dp"
    android:inputType="textPassword"
    android:ems="10" />
<Button
    android:id="@+id/btnRegistrace"
    android:onClick="Registrace"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="100dp"
    android:text="Registrovat" />
<TextView android:id="@+id/lnkLogin"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="40dp"
    android:text="Jste již registrován?? Přihlaste se zde."
    android:gravity="center"
    android:textSize="20dp"
    android:textColor="#3F51B5"
    android:onClick="test"/>



A: Do this: prijmeni = editPrijmeni.getEditableText().toString().trim(); in the onClick() method.
You are doing it at the creation of the Activity so the EditText control is empty. It won't automatically update the prijmeni string on change.
Here is how your code could look like with some small improvements.
It could also be further refined but it seems you just begin so it's already fine.
public class Registrace extends AppCompatActivity implements View.OnClickListener {
    private static final Pattern PASSWORD_PATTERN =
        Pattern.compile("^" + "(?=.*[0-9])" +
                "(?=.*[a-z])" + "(?=.*[A-Z])" + "(?=.*[@#$%^&+=])" + "(?=\\s+$)" + ".{6,}" + "$");

    private EditText editPrijmeni;
    private EditText editJmeno; 
    private EditText editEmail;
    private EditText editPwd;
    private EditText editPwd2;
    private Button btn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.activity_registrace);

        // Shouldn't you use a button instead of a text view?
        // It seems you want a "Login" button to go to a LoginActivity
        final TextView login = (TextView) findViewById(R.id.lnkLogin);
        login.setMovementMethod(LinkMovementMethod.getInstance());
        login.setOnClickListener(this);

        // You could use https://jakewharton.github.io/butterknife which simplifies this boilerplate code a lot 
        editJmeno = (EditText) findViewById(R.id.txtJmeno);
        editPrijmeni = (EditText) findViewById(R.id.txtPrijmeni);
        editEmail = (EditText) findViewById(R.id.txtEmail);
        editPwd = (EditText) findViewById(R.id.txtPassword);
        editPwd2 = (EditText) findViewById(R.id.txtPassword2);
        btn = (Button) findViewById(R.id.btnRegistrace);
        btn.setOnClickListener(this);
    }

    public boolean validujPrijmeni() {
        // if 'Mess' was for a validation message don't set it in the validation method.
        // define a string in your resources.
        // show/hide a TextView with that message from where you use the validation method.
        final String prijmeni = editPrijmeni.getEditableText().toString().trim();
        return !prijmeni.isEmpty();
    }

    // I would not declare the activity as a OnClickListener but use anonymous classes in the onCreate method
    // calling method on this class.
    // or if you use ButterKnife you can do so with OnClick annotations.
    // This is to prevent the use of switch which is not great code.
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.lnkLogin:
                Intent intent = new Intent(Registrace.this, Login.class);
                startActivity(intent);
                break;
        case R.id.btnRegistrace:
            Toast.makeText(this, "Registrace", Toast.LENGTH_SHORT).show();

            final String prijmeni = editPrijmeni.getEditableText().toString().trim();
            if (this.validujPrijmeni()) {
                Toast.makeText(this, prijmeni, Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(this, "Zadej příjmení", Toast.LENGTH_SHORT).show();
            }
            break;
        }
    }

}


A: you are getting values from edittext in on create.it's actually wrong cause in that time those edittexts are empty.the correct action is to get text from edittext in on click of register button
before
case R.id.btnRegistrace:
        Toast.makeText(this, "Registrace", Toast.LENGTH_SHORT).show();

        if(!prijmeni.isEmpty()) {
            Toast.makeText(this, prijmeni, Toast.LENGTH_SHORT).show();
        } else {
            Toast.makeText(this, "Zadej příjmení", Toast.LENGTH_SHORT).show();
        }
        break;

after
case R.id.btnRegistrace:
        Toast.makeText(this, "Registrace", Toast.LENGTH_SHORT).show();

        if(!editJmeno.getText().toString().isEmpty()) {
            Toast.makeText(this, editJmeno.getText().toString(), Toast.LENGTH_SHORT).show();
        } else {
            Toast.makeText(this, "Zadej příjmení", Toast.LENGTH_SHORT).show();
        }
        break;

