在Android异常中使用printStackTrace()是个坏主意? [英] Is it a bad idea to use printStackTrace() in Android Exceptions?
本文介绍了在Android异常中使用printStackTrace()是个坏主意?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
} catch(异常e){
e.printStackTrace();
}
解决方案
是的,这是一个坏的理念。您应该使用专门为这些目的设计的Android的内置日志类: http:/ /developer.android.com/reference/android/util/Log.html
它提供了日志调试消息,警告,错误等的选项。 / p>
Is it a bad idea to use printStackTrace() in Android Exceptions like this?
} catch (Exception e) {
e.printStackTrace();
}
解决方案
Yes, it is a bad idea. You should instead use Android's built-in log class specifically designed for these purposes: http://developer.android.com/reference/android/util/Log.html
It gives you options to log debug messages, warnings, errors etc.
这篇关于在Android异常中使用printStackTrace()是个坏主意?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文