I want you to just push the button after all EditText
's are filled
package com.example.marcosnogueira.appnote;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.*;
import android.content.*;
public class Principal extends AppCompatActivity {
private EditText nome;
private EditText nomlojcli;
private EditText endereco;
private EditText cpf;
private EditText cnpj;
private EditText tel;
private Button cadastrar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_principal);
nome = (EditText) findViewById(R.id.nome);
nomlojcli = (EditText) findViewById(R.id.nomlojcli);
endereco = (EditText) findViewById(R.id.endereco);
cpf = (EditText) findViewById(R.id.cpf)
cnpj = (EditText) findViewById(R.id.cnpj);
tel = (EditText) findViewById(R.id.tel);
cadastrar = (Button) findViewById(R.id.button);
cadastrar.setOnClickListener (new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder mensagem = new AlertDialog.Builder(Principal.this);
mensagem.setMessage("Cadastrado com Sucesso");
mensagem.setNeutralButton("Ok",null);
mensagem.show();
}
});
}
}