Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test for the appearance of a Toast message

Would anyone know how to test for the appearance of a Toast message on an Activity?

I'm using code similar to what the OP posted on this question for testing my program flow from one activity to the next. I'd also like to be able to test for toast messages on particular activities.

like image 722
Adrian Avatar asked Mar 08 '10 21:03

Adrian


People also ask

What are the main 3 parameters taken by a method when displaying a toast message?

The android docs specifically mention application context: "This method takes three parameters: the application Context, the text message, and the duration for the toast. It returns a properly initialized Toast object."

What are toast messages how can we display toast messages in an activity?

An Android Toast is a small message displayed on the screen, similar to a tool tip or other similar popup notification. A Toast is displayed on top of the main content of an activity, and only remains visible for a short time period.


1 Answers

Would anyone know how to test for the appearance of a Toast message on an Activity?

You can't -- sorry. By which, I mean there is no way to ask Android "hey, is a Toast showing? and what does it look like?".

like image 55
CommonsWare Avatar answered Oct 01 '22 06:10

CommonsWare