0
My application crashes when I write this code below, I am trying to stop the Login Class in the Registration Class and access the Login class methods through the Registration class.
ca.getLogar().setLogin(logCad.getText().toString());
ca.getLogar().setSenha(senhaCad.getText().toString());
Does anyone have any idea how to solve this ? These are the access method and attributes in the login class
private LoginClasse logar;
public LoginClasse getLogar() {
return logar;
}
public void setLogar(LoginClasse logar) {
this.logar = logar;
}
Login class
public class LoginClasse {
private String login;
private String senha;
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getSenha() {
return senha;
}
public void setSenha(String senha) {
this.senha = senha;
}
}
Register Class
public class CadastroClasse {
private String nome;
private String cpf;
private String tel;
private String end;
private String cep;
private String email;
private LoginClasse logar;
public LoginClasse getLogar() {
return logar;
}
public void setLogar(LoginClasse logar) {
this.logar = logar;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getCpf() {
return cpf;
}
public void setCpf(String cpf) {
this.cpf = cpf;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
public String getEnd() {
return end;
}
public void setEnd(String end) {
this.end = end;
}
public String getCep() {
return cep;
}
public void setCep(String cep) {
this.cep = cep;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
Registration method that is responsible for the problem
public void Cadastrar(View view)
{
CadastroClasse ca=new CadastroClasse();
ca.getLogar().setLogin(logCad.getText().toString());
ca.getLogar().setSenha(senhaCad.getText().toString());
ca.setNome(nome.getText().toString());
ca.setCpf(cpf.getText().toString());
ca.setTel(tel.getText().toString());
ca.setEnd(end.getText().toString());
ca.setCep(cep.getText().toString());
ca.setEmail(email.getText().toString());
startActivity(new Intent(Cadastro.this,MainActivity.class));
}