JFXSnackbar fireEvent issue when closing snackbar to hide previous event and show next one
See original GitHub issueHi there,
I do the following which causes an NPE in line JFXSnackbar:179 eventsSet.remove(currentEvent)
:
- snackbar.fireEvent(e1); //e1 should appear for 10 seconds for instance
- 5 seconds after showing e1 do: 2.1. snackbar.close();// To hide e1 2.2 snackbar.fireEvent(e2); // to show e2
This will produces an NPE right when e1 is going to finish at line 179, i.e., 10 seconds after firing e1.
A workaround for this issue is to check if currentEvent is not null right before removing it from eventsSet like this:
Replace eventsSet.remove(currentEvent);
with :
if (currentEvent != null)
eventsSet.remove(currentEvent);
Note that there are more issues to resolve when trying to fire more events between the time e1 is issued to the time e1 is finished (10 seconds in this example). However, this workaround is very simple to apply for now.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11
Top Results From Across the Web
JFXSnackbar fireEvent issue when closing snackbar to hide ...
fireEvent (e1); //e1 should appear for 10 seconds for instance 5 ... when closing snackbar to hide previous event and show next one...
Read more >JFXSnackbar fireEvent issue when closing snackbar to hide ...
JFXSnackbar fireEvent issue when closing snackbar to hide previous event and show next one.
Read more >How to use .show() for JFXSnackbar in java fx - Stack Overflow
In the newest version of JFoenix (jfoenix-8.0.8), the show() method is purposefully encapsulated or hidden in the JFXSnackbar class.
Read more >com.jfoenix.controls.JFXSnackbar.fireEvent java code examples
fireEvent (new SnackbarEvent(new JFXSnackbarLayout("Toast Message " + count)));... ... Persistent " + count, "CLOSE", action -> snackbar.close()), Duration.
Read more >Viewing online file analysis results for 'HMCL-3.2.130.jar'
... Evasive: Possibly tries to implement anti-virtualization techniques; Network Behavior: Contacts 1 domain and 1 host. View all details ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
(If it’s helpful, here’s what Web SnackBars interrupting each other looks like.)
I think I ran into this same problem today.
My stack trace looks like this:
I’m trying this
but trying to close the snackbar seems to be causing the above exception.
@aminabs, you’re referring to this line 179 (it’s now line 249), right?
@jfoenixadmin, what is the recommended way for SnackBars to interrupt each other?