Add Button to ToastBar Component

Viewed 42

Is it possible to add a component, like Button to a ToastBar? I want to add an action button that loads a new form when its clicked. Or is there any method exposed to add listeners to a ToastBar component?

2 Answers

You can't add an actual button to ToastBar at the moment but you can add an action event.

// 10 seconds on screen
ToastBar.showMessage("I am a toast message", FontImage.MATERIAL_OPEN_WITH, 10000, e -> {
    // ToastBar clicked, go to next form
});

Sure use something like:

tb.addMaterialCommandToRightSideMenu("", FontImage.MATERIAL_OPEN_WITH, e -> {
    // button click event
});
Related