【发布时间】:2016-10-01 22:03:44
【问题描述】:
每个 Android 开发者都被以下情况困住了:
public void catchMeThod() {
throwedMethod();
}
public void throwedMethod() throws IOException{
throw new IOException("File is missing.");
}
由于IOException 是检查异常throwedMethod 迫使我们处理它。
当我将插入符号移到 throwedMethod 中并按 Alt + Enter 时,Android Studio 为我提供了一些可能的场景:
默认情况下,我选择Surround with try/catch 选项,Android Studio 会生成下一个代码:
我的问题是:如何改变这个触发器,替换
e.printStackTrace()
与
Log.e(getClass().getSimpleName(), "Handled exception", e);
【问题讨论】:
标签: android android-studio intellij-idea