|
|
@@ -1,4 +1,4 @@
|
|
|
-package com.qy.agv.util;
|
|
|
+package com.ygtx.emcs.util;
|
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
@@ -10,8 +10,10 @@ import android.widget.LinearLayout;
|
|
|
import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
+import com.qy.agv.util.StringUtils;
|
|
|
+
|
|
|
public class ToastUtils {
|
|
|
-
|
|
|
+
|
|
|
/** 上下文. */
|
|
|
private static Context mContext = null;
|
|
|
|
|
|
@@ -74,8 +76,10 @@ public class ToastUtils {
|
|
|
Toast mToast = Toast.makeText(context, "", Toast.LENGTH_LONG);
|
|
|
mToast.setText(text);
|
|
|
LinearLayout linearLayout = (LinearLayout) mToast.getView();
|
|
|
- TextView messageTextView = (TextView) linearLayout.getChildAt(0);
|
|
|
- messageTextView.setTextSize(20);
|
|
|
+ if(linearLayout!=null) {
|
|
|
+ TextView messageTextView = (TextView) linearLayout.getChildAt(0);
|
|
|
+ messageTextView.setTextSize(20);
|
|
|
+ }
|
|
|
mToast.show();
|
|
|
}
|
|
|
}
|
|
|
@@ -89,8 +93,10 @@ public class ToastUtils {
|
|
|
Toast mToast = Toast.makeText(context, "", Toast.LENGTH_SHORT);
|
|
|
mToast.setText(text);
|
|
|
LinearLayout linearLayout = (LinearLayout) mToast.getView();
|
|
|
- TextView messageTextView = (TextView) linearLayout.getChildAt(0);
|
|
|
- messageTextView.setTextSize(25);
|
|
|
+ if(linearLayout!=null) {
|
|
|
+ TextView messageTextView = (TextView) linearLayout.getChildAt(0);
|
|
|
+ messageTextView.setTextSize(25);
|
|
|
+ }
|
|
|
mToast.show();
|
|
|
}
|
|
|
}
|
|
|
@@ -116,7 +122,7 @@ public class ToastUtils {
|
|
|
msg.setData(bundle);
|
|
|
baseHandler.sendMessage(msg);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 描述:在线程中提示文本信息.
|
|
|
@@ -141,8 +147,10 @@ public class ToastUtils {
|
|
|
}else{
|
|
|
mToast = Toast.makeText(context, "", length);
|
|
|
LinearLayout linearLayout = (LinearLayout) mToast.getView();
|
|
|
- TextView messageTextView = (TextView) linearLayout.getChildAt(0);
|
|
|
- messageTextView.setTextSize(25);
|
|
|
+ if(linearLayout!=null) {
|
|
|
+ TextView messageTextView = (TextView) linearLayout.getChildAt(0);
|
|
|
+ messageTextView.setTextSize(25);
|
|
|
+ }
|
|
|
mToast.setText(msg);
|
|
|
}
|
|
|
mToast.show();
|