Toast not shown in onEvent()
See original GitHub issueHi,
Just needed a quick way to show a Toast in an Activity if something in an other non-activity class fails. Found this librarie and used your How-To to quickly implement it.
This is virtually copy and pasted from your how to. but the Toast won’t show up even though the Log triggers. This Snippet is in my MainActivity. Toasts from other places in the code are working.
@Override
public void onStart() {
super.onStart();
EventBus.getDefault().register(this);
}
@Override
public void onStop() {
EventBus.getDefault().unregister(this);
super.onStop();
}
public void onEvent(errorEvent event){
Looper.prepare();
Log.v("Error! onEvent : ", event.message);
Toast.makeText(MainActivity.this, event.message, Toast.LENGTH_LONG).show();
}
Issue Analytics
- State:
- Created 9 years ago
- Comments:6
Top Results From Across the Web
Toast Message will not display if placed at the beggining of ...
I am having an issue with displaying a toast message. I want it to display when a button is initially clicked, so that...
Read more >ShowToastEvent notification is not displayed in LWC
In your case the 3 part is not performed because there's no component listening to ShowToastEvent so the toast is not showed.
Read more >Toasts - Bootstrap
Toasts. Push notifications to your visitors with a toast, a lightweight and easily customizable alert message. Toasts are lightweight notifications designed ...
Read more >A cleaner way to interact between Composable and ...
So lets create the onEvent function in our viewmodel as follows ... makeText(context,"All inputs are valid", Toast.LENGTH_SHORT) .show() }
Read more >Toast Notifications > Symfony UX: Turbo | SymfonyCasts
Let's fix that! Back in the controller, import Toast from bootstrap . Below add const toast = new Toast() and pass ...
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 FreeTop 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
Top GitHub Comments
Which EventBus version are you using?
onEventMainThread
was necessary in EventBus 2, but EventBus 3 uses annotations.Even with “onEventMainThread” I still get the issue with the need to call looper.prepare(); any ideas?