RSS Feed

The Use Of Toast

When I started developing Android Applications I could see that a lot of people were using Toast. Toast is a class that can be used to put up messages that fade away and is easy to use. So I can see why it is popular. Toast is an excellent aid for debugging as it works the same on a real device as it does on an emulator. Not that I have not found that logging does occur on both platforms too, but Toast is not cluttered by all kinds of other log entries, or the continuous posting of log entries even after your application may have failed.

You can obviously can tailor the way Toast displays itself. Here is an absolute basic version of a Toast call. Note you can control how long it displays on the screen.

Toast.makeText(???, “THIS IS MY TEXT”,Toast.LENGTH_LONG).show();

??? is the context, like myview.getContext()

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: