public class ToastUtils extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
ToastUtils.Duration |
| 限定符和类型 | 方法和说明 |
|---|---|
static android.app.Application |
getApplication()
已过时。
|
static android.widget.Toast |
getToast()
Get a Toast object
Need to call show() method to be displayed |
static void |
init(android.app.Application application)
AppToast initialization
|
static void |
showToast(CharSequence msg)
Display Toast
|
static void |
showToast(CharSequence msg,
int duration)
Display Toast
|
static void |
showToast(int resId)
Display Toast
|
static void |
showToast(int resId,
int duration)
Display Toast
|
public static void init(android.app.Application application)
application - Application public static void showToast(int resId)
resId - The resource id of the string resource to use. Can be formatted text.public static void showToast(CharSequence msg)
msg - The text to show. Can be formatted text.public static void showToast(int resId,
int duration)
resId - The resource id of the string resource to use. Can be formatted text.duration - How long to display the message. Either
Toast.LENGTH_SHORT or
Toast.LENGTH_LONGpublic static void showToast(CharSequence msg, int duration)
msg - The text to show. Can be formatted text.duration - How long to display the message. Either
Toast.LENGTH_SHORT or
Toast.LENGTH_LONGpublic static android.widget.Toast getToast()
@Deprecated public static android.app.Application getApplication()