首页 > 其他 > 详细

Andriod工具类

时间:2019-12-28 12:16:42      阅读:73      评论:0      收藏:0      [点我收藏+]

 

 /**
     * 打印方法路径
     * @param type 0:方法开始,1:方法结束,2:方法异常,3:方法
     */
    public static void printMethodPath(String type){
        Exception exception = new Exception();
        try {
            if ("0".equals(type)){
                type = "方法开始";
            }else if("1".equals(type)) {
                type = "方法结束";
            }else if("2".equals(type)) {
                type = "方法异常";
            } else {
                type = "方法";
            }
            //exception.getStackTrace()[0].getClassName():0为当前方法类名;1为调用者类名.
            Log.i(TAG,"Class———>:" + exception.getStackTrace()[1].getClassName() + exception.getStackTrace()[1].getMethodName() + type +  " line:" + exception.getStackTrace()[1].getLineNumber());
        } catch (Exception e) {
            e.printStackTrace();
            FileLog.e(TAG,e.getMessage(),e);
        }
    }

Andriod工具类

原文:https://www.cnblogs.com/mjtabu/p/12111049.html

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