The fact is that I need to click on an item in a list to 'execute' a URL
that returns a true or false answer, to confirm or cancel a reservation. I am using a AlertDialog
within a OnItemClickListener
to accept or cancel the confirmation of the reservation.
doInBackground
within AlertDialog
. Somehow it is not convenient to do this? Is there a viable alternative that you recommend for this case? I hope I have been able to express myself well. From already thank you very much.
This is my OnItemClickListener:
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(this,
"Click en posición: " + position + " idt: " + listaTurnosLibres.get(position).get("idt"),
Toast.LENGTH_LONG).show();
//ALERTDIALOG "¿Confirma sacar turno?".
AlertDialog.Builder builder = new AlertDialog.Builder(TurnosLibres.this);
builder.setMessage(R.string.dialog_sacar_turno)
.setCancelable(false)
.setPositiveButton(R.string.dialog_aceptar, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//Aceptar
}
})
.setNegativeButton(R.string.dialog_cancelar, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//Cancelar
}
});
AlertDialog alert = builder.create();
alert.show();
}
EDIT: