Good afternoon I am presenting the following problem, when trying to reload a fragment the application is hung and then the cell phone restarts.
The fragment AdminComment shows a listView that when you press one of these objects in the listView opens a dialog (DialogAdminRecomendation) and it gives two options Accept changes and cancel. At the end of the createSimpleDialog method I am adding the following line of code so that the Fragment AdminComment that is the container of the ListView is reloaded:
getFragmentManager().beginTransaction().detach(this).attach(this).commit();
Thank you very much if you help me by indicating if I am making a mistake or if you give me an idea of how to solve it.
Thank you in advance.
Attachment CreateSimpleDialog method
public AlertDialog createSimpleDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Aceptar Cambios")
.setMessage("Esta seguro de aceptar los cambios")
.setPositiveButton("SI",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
listener.onPossitiveButtonClickInsert(idMachinePointAux,titleAux,bodyCommentAux,usuarioFinalAux);
//envio correo avisando
}
})
.setNegativeButton("Eliminar Recomendación",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
listener.onNegativeButtonClickDelete(idMachinePointAux,titleAux,bodyCommentAux,usuarioFinalAux);
//envio correo avisando
}
});
getFragmentManager().beginTransaction().detach(this).attach(this).commit();
return builder.create();
}
Cordial Greetings