Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mobile Computing With Android ACST 4550 Toast

Similar presentations


Presentation on theme: "Mobile Computing With Android ACST 4550 Toast"— Presentation transcript:

1 Mobile Computing With Android ACST 4550 Toast

2 Toast A Toast message is a simple Pop-up message that hovers above your current activity for a limited amount of time. A Toast message doesn’t receive input while hit hovers, it only shows an output string. While it hovers, it only fills the amount of space required for the message and the current activity remains visible and interactive. Toasts automatically disappear after a timeout. You instantiate a Toast object by calling the makeText() methods This method takes three parameters: the application Context, the text message, and the duration for the toast (which can be either Toast.LENGTH_SHORT or Toast.LENGTH_LONG for shorter or longer amounts of time). The makeText() method returns a properly initialized Toast object that you can then display by calling the show() method.

3 Toast Toast messages can alert a user of an application state or provide timely messages for things like hints or debugging purposes. The following code generates a toast message telling the user to wait for something: Toast.makeText(getContext(),"Please Wait",Toast.LENGTH_SHORT).show(); See QuizActivty.java from the GeoQuiz app when the program calls checkAnswer() to see a Toast message. (In samplecode05.txt)


Download ppt "Mobile Computing With Android ACST 4550 Toast"

Similar presentations


Ads by Google