首页 > 移动平台 > 详细

android开发Tost工具类管理(一)

时间:2016-02-01 14:39:17      阅读:155      评论:0      收藏:0      [点我收藏+]

Tost工具类管理:

 1 package com.gzcivil.utils;
 2 
 3 import android.content.Context;
 4 import android.widget.Toast;
 5 
 6 /**
 7  * 
 8  * @author LiJinlun date 2016-01-10
 9  */
10 public class MyToast {
11     private static Toast mToast = null;
12 
13     /* 
14      * 一个Activity 可以显示多次 但是如果mToast已经显示了则只需改变内容,无须等待上次隐藏再次显示
15      */
16     public static void showToast(Context mContext, String text, int duration) {
17 
18         if (mToast != null)
19             mToast.setText(text);
20         else
21             mToast = Toast.makeText(mContext, text, duration);
22         mToast.show();
23     }
24 
25     public static void showToast(Context mContext, int aResId, int duration) {
26 
27         if (mToast != null)
28             mToast.setText(aResId);
29         else
30             mToast = Toast.makeText(mContext, aResId, duration);
31         mToast.show();
32     }
33 }

 

android开发Tost工具类管理(一)

原文:http://www.cnblogs.com/lijinlun0825/p/5174728.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!