Pop Up Toast Like Info Messages With Delphi XE5 Firemonkey On Android And IOS

If you have an info level event that you want to notify the user about in Delphi XE5 Firemonkey but you don’t need the user to click an Okay button about it the Android Toast messages might be what you’re looking for. You can launch a Toast to display something like ‘Low Battery’ or ‘Low Memory’ to the user. You are notifying the user of the event without disturbing their usage of your app. As you can see in the screenshot the Toast message pops up in a rectangle on the screen. Usually it fades in and then fades about again. Toast is a native Android feature but there is some code I found which will also give you a similar message system in your IOS apps. These two units are from Delphi developer Paul Thornton. Here is some code from the Android.JNI.Toast.pas unit:

Thanks. I did not see that you had to set the path for each platform.
One suggestion. Can I suggest a property “WordWrap” which is linked to the “OptimalWidth”. At the
moment it wraps the text which does not always look so good.

I am using your Toast unit, thanks to implement it. Why dont you create a repository for it also?

There are 2 issues on the component right now:

– I am using it as a large band in the middle of the window, It works fine, however after the timer event is fired and it gets “closed” actually the rectangle remains there, and consumes all the mouse clicks. I thought I was suffering another FMX bug then I realized was the Toast area. I believe using small rectangles you did not noticed that.
– The other problem is that for unknown reason in one of my projects I removed the component and replaced it again, and since there is a tabcontrol with animation to switch pages the toast rectangle is anchored in one of the pages and I see it passing by when the page is animated for change. I dont understand why, since I have another exact copy of this project where I did not remove the component and the Toast message is on the form level.

If you could fix that bug when closing the rectangle I would appreciate much. Just put a TEdit and open a Toast over it and you can see the problem after closing. You cannot select the TEdit anymore.

It is definitely in the source of the unit FMX.AndroidLike.Toast.pas in the download (check if this is the case in the unit which you use for development).
You should recompile the component package and should be able to see the wordwrap property in the objectinspector.