I have a layout with a button.
The onclick shows an AlertDialog, with the options Ok and Cancel. I want that if one clicks on the "Ok", the button in the layout disappears.
Here's my code so far:
In the main, I have this function:
public void requestCheckButton(View view) {
RequestAccepted ra = new RequestAccepted(this);
}
The RequestAccepted function:
public class RequestAccepted {
Context context;
public RequestAccepted(final Context context){
this.context = context;
final AlertDialog.Builder popDialog = new AlertDialog.Builder(context);
final SeekBar seek = new SeekBar(context);
seek.setMax(11); // Para tener incrementos de 5 min
seek.setProgress(1);
popDialog.setTitle("¿En cuánto tiempo puedes llegar?");
popDialog.setMessage("5 min");
popDialog.setView(seek);
popDialog.setPositiveButton("Mandar", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(context, "Presionaste Mandar", Toast.LENGTH_SHORT).show();
}
});
final AlertDialog dialog = popDialog.create();
seek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
int progress = 1;
public void onProgressChanged(SeekBar seekBar, int progressV, boolean fromUser) {
progress = progressV;
}
public void onStartTrackingTouch(SeekBar arg0) {
}
public void onStopTrackingTouch(SeekBar seekBar) {
//Por cada incremento se suman 5 min
dialog.setMessage((progress)*5 +" min");
}
});
dialog.show();
}