Java android.widget Toast fields, constructors, methods, implement or subclass

Example usage for Java android.widget Toast fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for android.widget Toast.

The text is from its open source code.

Field

intLENGTH_SHORT
Show the view or text notification for a short period of time.
intLENGTH_LONG
Show the view or text notification for a long period of time.

Constructor

Toast(Context context)
Construct an empty Toast object.

Method

voidcancel()
Close the view if it's showing, or don't show it if it isn't showing yet.
intgetGravity()
Get the location at which the notification should appear on the screen.
ViewgetView()
Return the view.
intgetXOffset()
Return the X offset in pixels to apply to the gravity's location.
intgetYOffset()
Return the Y offset in pixels to apply to the gravity's location.
ToastmakeText(Context context, CharSequence text, @Duration int duration)
Make a standard toast that just contains a text view.
ToastmakeText(Context context, @StringRes int resId, @Duration int duration)
Make a standard toast that just contains a text view with the text from a resource.
voidsetDuration(@Duration int duration)
Set how long to show the view for.
voidsetGravity(int gravity, int xOffset, int yOffset)
Set the location at which the notification should appear on the screen.
voidsetText(@StringRes int resId)
Update the text in a Toast that was previously created using one of the makeText() methods.
voidsetText(CharSequence s)
Update the text in a Toast that was previously created using one of the makeText() methods.
voidsetView(View view)
Set the view to show.
voidshow()
Show the view for the specified duration.