【发布时间】:2012-01-01 06:25:49
【问题描述】:
活动/应用程序中的许多导入语句会影响 android 的性能吗?
示例情况1:
在一个活动/public class(我们称之为DialogHelper.java)中,我在这个单个 DialogHelper.java 中处理所有应用程序对话框,并且我在该活动中有多个导入语句,它会影响运行时性能还是有任何影响手机内存还是降低性能?
示例情况2:
而不是使用这个根本不需要导入的catch (Exception e)
try {
String url = "data";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
activity.startActivity(i);
} catch (Exception e) {
//Exception here
}
我用的是这个,需要导入android.content.ActivityNotFoundException;,哪个更好?
try {
String url = "data";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
activity.startActivity(i);
} catch (ActivityNotFoundException e) {
//Exception here
}
【问题讨论】:
标签: android performance import