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.

2068 questions
57
votes
17 answers

Android - Hide all shown Toast Messages

How do I remove all toast messages currently displayed? In my App, there is a list, when a user clicks on an item, a toast message is displayed, 10 items - 10 toast messages. So if the user clicks 10 times, then presses the menu button, they have to…
crazyV
  • 571
  • 1
  • 4
  • 3
54
votes
10 answers

Android: How to set the colour of a Toast's text

I am displaying a toast message as the result of an if statement using the following code: Toast.makeText(getBaseContext(), "Please Enter Price", Toast.LENGTH_SHORT).show(); It is displayed as white text on a white background, as such it can not be…
super
  • 4,139
  • 4
  • 23
  • 20
54
votes
9 answers

how can I change the color of Toast depends on message type in Angular material $mdToast?

While using $mdToast.simple().content("some test") it is showing the toast with black color. how can I change that color to red, yellow and so, depends on the type of the error messages like error, warning and success. Similar question as this.
Rafiu
  • 4,700
  • 6
  • 25
  • 27
53
votes
6 answers

What is the android.widget.Toast equivalent for iOS applications?

I have made Android application a few months ago. The Toast class is very useful for me. I do not need to consider the main Thread and place to show it. Anywhere I can show it and just leave that and it is automatically…
mooongcle
  • 3,987
  • 5
  • 33
  • 42
49
votes
3 answers

Android Service to show toast

This code is supposed to use a service to show a toast message. There are no errors, but it doesn't show the toast. main activity public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { …
codenamejupiterx
  • 1,589
  • 9
  • 23
  • 34
48
votes
5 answers

How to configure Toast icon in Android 12?

Starting with Android 12, Google show a toast message with an app icon. My application have launcher icon. Android 12 splash screen show app icon correctly. Show toast by code Toast.makeText(this, "Show simple toast",…
Denis
  • 2,622
  • 3
  • 22
  • 24
37
votes
6 answers

Toast.getView() returns null on Android 11 (API 30)

I just installed the Android R (API 30) image in my emulator to try my app, and it crashed when trying to set the Background color of a Toast. Toast toast = Toast.makeText(ctxt, msg, duration); View view = toast.getView(); …
pvalle
  • 1,335
  • 1
  • 13
  • 20
37
votes
19 answers

Android Toast equivalent in iOS

Does anyone know what the Java Toast equivalent of this iOS Objective C event would be in a Fragment? Below is a sample of what I have written in iOS. What I am looking for the same Alert in Java using a Toast in place of the iOS UIAlert. I am…
Bil Kimes
  • 371
  • 1
  • 3
  • 5
36
votes
12 answers

Can I cancel previous Toast when I want to show an other Toast?

In my app, I construct a calendar widget for my activity, when I scroll it to previous or next month, I let it make a toast and show it. The question is, the toast need time to show, when I scroll it fast enough, for example, I scrolled to "2012/05"…
topxebec
  • 1,417
  • 3
  • 15
  • 29
35
votes
13 answers

Toast is not rendered (react-toastify component)

I'm using react-toastify and I can't get a simple toast to be rendered... import React from "react"; import { toast } from 'react-toastify'; class MyView extends React.Component<{}, {}> { constructor() { super(); this.state =…
kevinob
  • 558
  • 2
  • 6
  • 14
35
votes
7 answers

Error due to invalid combination of Toast and OnClickListener

I'm trying to use Toast inside OnCLickListener. My code triggers the following error: The method makeText(Context, CharSequence, int) in the type Toast is not applicable for the arguments (new View.OnClickListener(){}, String, int) This is my…
Harsha M V
  • 54,075
  • 125
  • 354
  • 529
34
votes
14 answers

Finish activity after toast message disappears?

Does anybody know, if there is a possibility to do something (in my case finish activity) on toast message will be closed?
Tima
  • 12,765
  • 23
  • 82
  • 125
34
votes
7 answers

Set Toast Appear Length

Is there anyway I can tell a Toast Notification to show up only for a specified amount of time. Generally shorter then a regular toast message.
Mitchell
  • 929
  • 2
  • 11
  • 34
33
votes
4 answers

What is the value of Toast.LENGTH_LONG and Toast.LENGTH_SHORT?

I am printing Toast message in my application to show notification but i want to know value of Toast.LENGTH_LONG and Toast.LENGTH_SHORT. What other values i can use. Can anyone tell me what is the value of these two variables?
CoDe
  • 11,056
  • 14
  • 90
  • 197
32
votes
1 answer

JavaFX: Undecorated Window

I am attempting to make a Windows PC Toast notification. Right now I am using a mixture of Swing and JavaFX because I did not find a way to make an undecorated window with FX. I would much prefer to only use JavaFX. So, how can I make an undecorated…
Dorothy
  • 2,842
  • 10
  • 33
  • 46