Wellcome and enjoy.

I would like to welcome you on my blog and thank for time you spend reading it I hope you will enjoy.It is personal creation of me, Lukas Tencer, and it will map my professional success as well as my personal interests.

Monday, January 25, 2010

Today`s Menu: Toast and Android

Hi and welcome to my third Android post. So long I am now on tutorial #6 from previously mentioned guide, and there are no slighter difficulties. One useful tweak I would like to talk about is class Toast in Android API.

Toast is used for displaying short messages for user. It`s main plus is, that it does not steal focus, so it is perfectly suitable to report about completed actions as: your message have been send, alarm have been set, option are saved etc.

It is defined as follows:
Toast.makeText(getApplicationContext(), "Saved!", Toast.LENGTH_SHORT).show().

First argument is just Context of current application, above which Toast should be displayed, second parameter is text of Toast itself and at last, there is parameter about duration. You could choose SHORT or LONG. Does not forgot about .show() parameter in the end, or else you will be lost as me and keep googling. Message itself has native look, so it is perfectly suitable for short messages. By now it is also for me only way to debug applications, because I am not so far by now. As soon I will come in touch with debuging, I will report as soon as possible.

Good bye for now and have some Toast. :-)

No comments:

Post a Comment