samedi 6 juin 2020

How do i add an if-else statement in these lines of code?

I want to make sure my user fill in all the spaces provided in the interface before they are qualified to create an account. Where can I add the if-else statement in these lines of codes? I am doing this to ensure the user inserted all the data before going to the profile page. Please help me guys.

 createacc.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MainActivity.this, profile.class);
            startActivity(intent);
            getData();
        }
    });
}

private void getData() {
    email = "" + Pemail.getText().toString().trim();
    name = "" + Pname.getText().toString().trim();
    age = "" + PAge.getText().toString().trim();
    phone = "" + Pphone.getText().toString().trim();
    preferenceselected = "" + Ppreferenceselected.getText().toString().trim();
    password = "" + Ppassword.getText().toString().trim();

    String timeStamp = "" + System.currentTimeMillis();

    boolean id = dbHelper.insertInfo(
            "" + imageUri,
            "" + email,
            "" + name,
            "" + age,
           "" + phone,
            "" + preferenceselected,
            "" + password,
            ""+timeStamp,
            ""+timeStamp

    );

        Toast.makeText(this, "Account Created", Toast.LENGTH_SHORT).show();
}

Aucun commentaire:

Enregistrer un commentaire