Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.39 KB | None | 0 0
  1. @Override
  2.     protected void onCreate(Bundle savedInstanceState) {
  3.         super.onCreate(savedInstanceState);
  4.         setContentView(R.layout.activity_cadastro_usuario);
  5.  
  6.         initFormulario();
  7.  
  8.  
  9.         btnCadastro.setOnClickListener(new View.OnClickListener() {
  10.             @Override
  11.             public void onClick(View v) {
  12.  
  13.                 if (TextUtils.isEmpty(editNome.getText().toString())) {
  14.                     editNome.setError("*");
  15.                     editNome.requestFocus();
  16.                 }
  17.  
  18.                 if(isFormularioOK){
  19.                 Intent iMenuPrincipal = new Intent(CadastroUsuarioActivity.this,MainActivity.class);
  20.                 startActivity(iMenuPrincipal);
  21.             }
  22.         }
  23.  
  24.  
  25.  
  26.     private void initFormulario() {
  27.  
  28.         btnCadastro = findViewById(R.id.btnCadastro);
  29.         editNome = findViewById(R.id.editNome);
  30.         editEmail = findViewById(R.id.editEmail);
  31.         editSenhaA = findViewById(R.id.editSenhaA);
  32.         editSenhaB = findViewById(R.id.editSenhaB);
  33.         ckTermo = findViewById(R.id.ckTermo);
  34.  
  35.         isFormularioOK = false;
  36.     }
  37.  
  38.     public void validarTermo(View view) {
  39.  
  40.         if (!ckTermo.isChecked()) {
  41.  
  42.             Toast.makeText(getApplicationContext(), "É necessário aceitar os termos para continuar o cadastro" +
  43.                     " !!! ...", Toast.LENGTH_LONG).show();;
  44.  
  45.         }
  46.  
  47.  
  48. }
  49. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement