MaterialDesignLibrary
MaterialDesignLibrary copied to clipboard
Dialog closing twice
I had set the dialog for a menu option click, when I press the close button it acts like it is closing twice. I have just copied your code for test.
public void settings_click(MenuItem item) {
Dialog dialog = new Dialog(MainActivity.this, "Title", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam");
dialog.setOnAcceptButtonClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "Click accept button", Toast.LENGTH_LONG).show();
}
});
dialog.setOnCancelButtonClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "Click cancel button",Toast.LENGTH_LONG).show();
}
});
dialog.show();
}
the setting menu is randomly generated by android studio on creation, I have just added onClick to it.
When I press the accept or cancel button, there is a really bad closing. It acts like closing twice or something, the activity jumps when the dialog closes..
Is there anything else that I must do to make it smooth?
I have the same problem as @MelodyAustin. I'm on Android 4.2.2. The behavior is just like MelodyAststin described: it's like the dialog is closing (disappearing), then coming back very quickly, and then finally closing for real. I downloaded the latest version of the demo apk file, and the dialog behaves the same way there. I have not seen this problem in emulators running android 4.4.2 (have not tried any other emulator).
I hope you can find the source of this bug. I really like your library!
I also came across this!
Same here!
That behavior can't be reproduced testing in an emulator with Nexus 4 with Android 2.3.7, but in a real device such as Samsung Galaxy S3 with Android 4.2.2 it happens.
Same problem on Android 4.2.1 and Android 4.2.2 On Android 4.4.4 works well. Has anyone found a solution?
I had to add another library for dialogs
https://github.com/afollestad/material-dialogs
I had the same problem. I hope you find this bug. I really like your library.
Me too, I'm using three different libraries, for Snackbars, Dialogs and Floating Actions in accordance with Material Design spec:
- https://github.com/afollestad/material-dialogs
- https://github.com/nispok/snackbar
- https://github.com/str4d/android-floating-action-button
Hi, i work also in this library, but unfortunately we don't have any device with these characteristics. If anyone who has any of these devices and can solve the problem, please let us know and we will include the solution on a new version.