-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathToastUtils.java
More file actions
37 lines (28 loc) · 746 Bytes
/
ToastUtils.java
File metadata and controls
37 lines (28 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.hht.baselib.ui;
import android.content.Context;
import android.widget.Toast;
/**
* @author Realmo
* @version 1.0.0
* @name
* @email momo.weiye@gmail.com
* @time 2019/6/24 9:39
* @describe
*/
public class ToastUtils {
private static Toast mToast;
public static void toast(Context context,String text,int duration){
if(mToast != null){
mToast.cancel();
}
mToast = Toast.makeText(context,text,duration);
mToast.show();
}
public static void toast(Context context,int textId,int duration){
if(mToast != null){
mToast.cancel();
}
mToast = Toast.makeText(context,context.getText(textId),duration);
mToast.show();
}
}