Questions tagged [toast]

A toast notification is a transient message to the user that contains relevant, time-sensitive information and provides quick access to related content in an app.

A toast notification is a small informational popup window in a GUI, used to notify the user of an event or status change. The user cannot interact with a toast notification, which fades away after a short amount of time. The term was allegedly coined during the development of MSN Messenger because the notification windows slid up from the bottom of the screen, like toast popping up from a toaster.

Within stackoverflow, the tag most often refers to the Android class android.widget.Toast. For more information, see Creating Toast Notifications.

1826 questions
459
votes
21 answers

How to display Toast in Android?

I have a slider that can be pulled up and then it shows a map. I can move the slider up and down to hide or show the map. When the map is on front, I can handle touch events on that map. Everytime I touch, a AsyncTask is fired up, it downloads some…
Upvote
  • 65,847
  • 122
  • 353
  • 577
302
votes
12 answers

How to change position of Toast in Android?

When I use Toast to display some popup text on the screen, it displays the text a little bit above the bottom of the screen, which is the default position. Now I want to display it in the middle of screen or somewhere according to my choice. Can…
UMAR-MOBITSOLUTIONS
  • 73,009
  • 94
  • 197
  • 273
222
votes
31 answers

How to create Toast in Flutter?

Can I create something similar to Toasts in Flutter? Just a tiny notification window that is not directly in the face of the user and does not lock or fade the view behind it?
Shady Aziza
  • 34,951
  • 15
  • 97
  • 103
200
votes
6 answers

Call to getLayoutInflater() in places not in activity

What does need to be imported or how can I call the Layout inflater in places other than activity? public static void method(Context context){ //this doesn't work the getLayoutInflater method could not be found LayoutInflater inflater =…
Lukap
  • 29,596
  • 60
  • 146
  • 239
129
votes
10 answers

Displaying a stock iOS notification banner when your app is open and in the foreground?

When Apple's official iOS Messages app is open and in the foreground, new messages from other contacts trigger a stock, native iOS notification alert banner. See image below. Is this possible in 3rd party apps on the App Store? Local and/or Push…
pkamb
  • 26,648
  • 20
  • 124
  • 157
126
votes
4 answers

difference and when to use getApplication(), getApplicationContext(), getBaseContext() and someClass.this

I'm new to android and I'm trying to understand the difference between getApplication(), getApplicationContext(), getBaseContext(), getContext() and someClass.this and especially when to use the these methods in the following code lines: When I…
Pheonix7
  • 1,941
  • 4
  • 20
  • 35
123
votes
17 answers

Custom toast on Android: a simple example

I'm new to Android programming. What is a simple example showing a custom toast notification on Android?
Sandy
  • 2,261
  • 7
  • 31
  • 60
103
votes
7 answers

What is the duration of a Toast LENGTH_LONG and LENGTH_SHORT

I need the exact duration of LENGTH_LONG and LENGTH_SHORT in milliseconds (ms). Also I need to know if the duration of Toast message with LENGTH_LONG will have the same duration in any phone and with any API version. Does someone know where is the…
Lukap
  • 29,596
  • 60
  • 146
  • 239
99
votes
18 answers

Toast equivalent for Xamarin Forms

Is there any way using Xamarin Forms (not Android or iOS specific) to have a pop-up, like Android does with Toast, that needs no user interaction and goes away after a (short) period of time? From searching around all I'm seeing are alerts that…
Jimmy
  • 1,119
  • 1
  • 9
  • 11
95
votes
7 answers

java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare();

I have an Android app running a thread. I want a Toast message to show with a message. When I do this, I get the below exception: Logcat trace: FATAL EXCEPTION: Timer-0 java.lang.RuntimeException: Can't create handler inside thread that has not …
Amar
  • 997
  • 2
  • 7
  • 6
84
votes
2 answers

Why are Android popup messages called toasts?

My guess it that the lightweight notifications in Android are called Toast because they popup like toast from a toaster. Can anyone confirm this or provide a better explanation? I am teaching a course on Android development and would like to edit…
Ellen Spertus
  • 5,875
  • 9
  • 47
  • 82
83
votes
4 answers

getting context in AsyncTask

I am trying to get the context in my AsyncTask of the class called Opciones(this class is the only one that call that task) but I don't know how to do it, I saw some code like this: protected void onPostExecute(Long result) { …
D4rWiNS
  • 2,373
  • 5
  • 28
  • 51
80
votes
14 answers

Checking toast message in android espresso

Would anyone know how to test for the appearance of a Toast message in android espresso? In robotium its easy & I used but started working in espresso but dont getting the exact command.
Humayun Rana
  • 813
  • 1
  • 6
  • 7
71
votes
6 answers

What does "toast" mean?

Curious what "Toast" means? Saw this and am curious... Similar Posts How to add toast style popup to my application? Program to show a "toast" notification popup from the Windows command line? Why does my text keep highlighting? Thread-safe…
madcolor
  • 7,838
  • 10
  • 45
  • 73
70
votes
13 answers

Use Toast inside Fragment

I'm trying to show a Toast Message when user click on a Button inside a Fragment. The problem is I cannot access the activity to show the Toast on it. Here's the source of Fragment: public class FrgTimes extends Fragment { ScrollView…
mammadalius
  • 2,955
  • 5
  • 34
  • 44
1
2 3
99 100