这个工具类是阅读郭大牛的文章记录下来的方法,没有想过这些细节的问题,记录一下以后学习:
public class Utils{
private static Toast toast;
public static void showToast(Context context,String content){
if( toast == null){
toast =Toast.makeText(COntext context,String content){
toast = Toast.makeText(context,content,Toast.Length_ShORT);
}else{
toast.setText(content);
}
toast.show();
}
}
}