0
Good afternoon, I’m having a problem... When clicking on a button appears the alertDialog custom, IE contains an Edittext in it and a button Positive to the conclusion. Only I need to rescue the editText text in order to insert it into my database and I’m not getting it. I put it in the Log nothing appears, so I did a debug, put a breakpoint to see if at least I was rescuing a getText()
and when I see it inserts the value as empty " "
I don’t know what to do, could someone give me a hand? I did gettext(). toString and nothing of value....
code:
private AlertDialog.Builder dialogs;
private String tsl;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
golFora = (ImageButton) findViewById(R.id.golForaId);
golFora.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
contador1++;
valorDouble.setText("" + contador1);
Context gol = getApplication();
CharSequence texto = "Goooll!";
int tempo = Toast.LENGTH_SHORT;
Toast apresentar = Toast.makeText(gol, texto, tempo);
apresentar.show();
View vi = LayoutInflater.from(getApplicationContext()).inflate(R.layout.caixa_jogador_dialog, null);
teset = (EditText) vi.findViewById(R.id.caixa_dialog_1);
//criado só para o Log
tsl = teset.getText().toString();
dialogs = new AlertDialog.Builder(SimplesHome.this);
dialogs.setPositiveButton("Sim", new
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Log.i("CAMPOS", tsl);
Esporte s = new Esporte();
s.setJogadoresFora(teset.getText().toString());
}
});
dialogs.setView(vi);
dialogs.create();
dialogs.show();
}
});
Thank you....
opa... then the recovered value of editText is being sent as null to the bank...
– Nathan
Check the code because it has to work. Check if Edittext is the
R.id.caixa_dialog_1
and who introduced something into it.– ramaral
Sorry, it worked... my problem now, I do not know why it is not going to the database, but Edit id recovery worked... Thank you
– Nathan