0
I have a simple question for those who already understand Java but this breaking my head.
Being direct, I have my Mainactivity and a layout with two Edittext’s and a button, and a Systemshttp Class.
I wanted that when I clicked on the button, the values of the fields went to the Systemshttp, checked the user and password and showed the return in Mainactivity.
The problem is that since I’m a beginner in Java I can’t do this, but I already have a function base (almost) working:
Mainactivity:
txt_usuario = (EditText) findViewById(R.id.usuario);
txt_senha = (EditText) findViewById(R.id.senha);
btn_login = (Button) findViewById(R.id.btn_login);
btn_login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String user = txt_usuario.getText().toString();
String pssw = txt_senha.getText().toString();
SistemaHttp sHttp = new SistemaHttp(getBaseContext());
sHttp.retornaUsuario(user, pssw);
}
});
Systemshttp:
public String retornaUsuario(String user, String pssw)
{
String u = "Teste";
String s = "123";
String resp = "";
if (user.equals(u) && pssw.equals(s))
{
resp = "OK";
}
else
{
resp = "ERRO";
}
MainActivity main = new MainActivity();
main.retornoLogin(resp);
}
Caraca old, thanks anyway, Voce explaining is so simple but as I am beginner in this language was more lost than blind and shooting kk
– Bruno Romualdo