常用工具类

 1 import android.util.Log;

 2 

 3 /**

 4  * @author orca

 5  * Log工具类,方便打印log

 6  * 封装了info,debug,error,方法

 7  * 添加了分隔线

 8  */

 9 public class LogUtil {

10     private static String TAG = "ace";

11 

12     public static void getInfoLog(String msg) {

13         Log.i(TAG, msg);

14     }

15 

16     public static void getDebugLog(String msg) {

17         Log.d(TAG, msg);

18     }

19 

20     public static void getErrorLog(String msg) {

21         Log.i(TAG, msg);

22     }

23 

24     public static void getDivider() {

25         Log.d(TAG, "************************************");

26     }

27 

28 }

 

 1 import android.content.Context;

 2 import android.widget.Toast;

 3 

 4 /**

 5  * @author orca

 6  * Toast工具类

 7  * 

 8  */

 9 public class ToastUtil {

10 

11     public static void shortShow(Context context, String msg) {

12         Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();

13     }

14 

15     public static void longShow(Context context, String msg) {

16         Toast.makeText(context, msg, Toast.LENGTH_LONG).show();

17     }

18 

19 }

 

你可能感兴趣的:(工具类)