1
I’m having a problem Toast doesn’t show up when I make a request on for my web service, the whole method stays inside my thread, I did a test putting a message out of the thread then it shows up, but right where I need it, it does not display with the message I need to show to the user.
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
try {
loginDao = new LoginDao(databaseHelper.getConnectionSource());
login = loginDao.queryForId(1);
} catch (SQLException e) {
e.printStackTrace();
}
DadosCadastraisSerealizable dados = new DadosCadastraisSerealizable();
dados.codigo= String.valueOf(login.getCodigoCliente());
dados.usuario=login.usuario;
dados.senha=login.senha;
//expressão regular para enviar somente o numeros.
String[] cepText = edtCep.getText().toString().split("-");
dados.cep= cepText[0]+cepText[1];
dados.bairro= edtBairro.getText().toString();
dados.endereco= edtEndereco.getText().toString();
dados.numero= edtnumero.getText().toString();
dados.complemento= edtComplemento.getText().toString();
dados.foneComercial= edtFoneComercial.getText().toString();
dados.foneResidencial= edtFoneResidencial.getText().toString();
dados.foneCelular= edtFoneCelular.getText().toString();
dados.email= edtEmail.getText().toString();
try {
WebService ws = new WebService();
ws.atuzalizarCadastroCliente(dados);
Toast.makeText(getApplicationContext(), ws.strFault, Toast.LENGTH_SHORT).show();
} catch (IOException e) {
e.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
}
}
}).start();
}
It worked perfectly, thank you
– rodrigo.oliveira