80,476
社区成员
发帖
与我相关
我的任务
分享
这个问题是为什么打断点会跑到
private static NumberFormatException invalidInt(String s) {
throw new NumberFormatException("Invalid int: \"" + s + "\"");
}
没说崩溃啊
你自己debug用f5跟一下,就是因为return Integer.parseInt(name);
才进去的![/quote]
原来这样


public int getIdentifier(String name, String defType, String defPackage) {
if (name == null) {
throw new NullPointerException("name is null");
}
try {
return Integer.parseInt(name);
} catch (Exception e) {
// Ignore
}
return mAssets.getResourceIdentifier(name, defType, defPackage);
}
第一个参数会调用 Integer.parseInt(name);
所以就抛出异常了NumberFormatException[/quote]
name中含有非数字吧[quote=引用 11 楼 dalor 的回复:] 能进? NumberFormatException里调用的方法forInputString,没有方法叫invalidInt。 我能说,这个方法可能是他自己定义的吗?
能进? NumberFormatException里调用的方法forInputString,没有方法叫invalidInt。 我能说,这个方法可能是他自己定义的吗?
[quote=引用 8 楼 dalor 的回复:] 都别扯可好,可用过? 你看到源码上把那个异常打印出来了?抛出来了?没看到Ignore啊。 这个方法的作用本身就是通过文件名查到资源id的。还说得像真的一样。 你把异常信息贴出来。就你那样的描述,不清楚。
这个问题是为什么打断点会跑到
private static NumberFormatException invalidInt(String s) {
throw new NumberFormatException("Invalid int: \"" + s + "\"");
}
没说崩溃啊
你自己debug用f5跟一下,就是因为return Integer.parseInt(name);
才进去的![/quote]
另外,坛主,我是引用你楼下滴那个,结果把你的引进了。。。失误失误
[quote=引用 8 楼 dalor 的回复:] 都别扯可好,可用过? 你看到源码上把那个异常打印出来了?抛出来了?没看到Ignore啊。 这个方法的作用本身就是通过文件名查到资源id的。还说得像真的一样。 你把异常信息贴出来。就你那样的描述,不清楚。
这个问题是为什么打断点会跑到
private static NumberFormatException invalidInt(String s) {
throw new NumberFormatException("Invalid int: \"" + s + "\"");
}
没说崩溃啊
你自己debug用f5跟一下,就是因为return Integer.parseInt(name);
才进去的![/quote]
能进?
NumberFormatException里调用的方法forInputString,没有方法叫invalidInt。
我能说,这个方法可能是他自己定义的吗?[quote=引用 8 楼 dalor 的回复:] 都别扯可好,可用过? 你看到源码上把那个异常打印出来了?抛出来了?没看到Ignore啊。 这个方法的作用本身就是通过文件名查到资源id的。还说得像真的一样。 你把异常信息贴出来。就你那样的描述,不清楚。
这个问题是为什么打断点会跑到
private static NumberFormatException invalidInt(String s) {
throw new NumberFormatException("Invalid int: \"" + s + "\"");
}
没说崩溃啊
你自己debug用f5跟一下,就是因为return Integer.parseInt(name);
才进去的![/quote]
好吧,我承认不够淡定了。
不过,
try {
return Integer.parseInt(name);
} catch (Exception e) {
// Ignore
}
debug能进
private static NumberFormatException invalidInt(String s) {
throw new NumberFormatException("Invalid int: \"" + s + "\"");
}?
求图。
[quote=引用 8 楼 dalor 的回复:] 都别扯可好,可用过? 你看到源码上把那个异常打印出来了?抛出来了?没看到Ignore啊。 这个方法的作用本身就是通过文件名查到资源id的。还说得像真的一样。 你把异常信息贴出来。就你那样的描述,不清楚。
这个问题是为什么打断点会跑到
private static NumberFormatException invalidInt(String s) {
throw new NumberFormatException("Invalid int: \"" + s + "\"");
}
没说崩溃啊
你自己debug用f5跟一下,就是因为return Integer.parseInt(name);
才进去的![/quote]
能进?
NumberFormatException里调用的方法forInputString,没有方法叫invalidInt。
我能说,这个方法可能是他自己定义的吗?
都别扯可好,可用过? 你看到源码上把那个异常打印出来了?抛出来了?没看到Ignore啊。 这个方法的作用本身就是通过文件名查到资源id的。还说得像真的一样。 你把异常信息贴出来。就你那样的描述,不清楚。
这个问题是为什么打断点会跑到
private static NumberFormatException invalidInt(String s) {
throw new NumberFormatException("Invalid int: \"" + s + "\"");
}
没说崩溃啊
你自己debug用f5跟一下,就是因为return Integer.parseInt(name);
才进去的![quote=引用 5 楼 sunjinshengli 的回复:]从drawable调用资源的方法! resourses.getIdentifier这个方法是干嘛的
public int getIdentifier(String name, String defType, String defPackage) {
if (name == null) {
throw new NullPointerException("name is null");
}
try {
return Integer.parseInt(name);
} catch (Exception e) {
// Ignore
}
return mAssets.getResourceIdentifier(name, defType, defPackage);
}
第一个参数会调用 Integer.parseInt(name);
所以就抛出异常了NumberFormatException[/quote]
[quote=引用 6 楼 inquisitive_plus 的回复:] [quote=引用 5 楼 sunjinshengli 的回复:]从drawable调用资源的方法! resourses.getIdentifier这个方法是干嘛的
public int getIdentifier(String name, String defType, String defPackage) {
if (name == null) {
throw new NullPointerException("name is null");
}
try {
return Integer.parseInt(name);
} catch (Exception e) {
// Ignore
}
return mAssets.getResourceIdentifier(name, defType, defPackage);
}
第一个参数会调用 Integer.parseInt(name);
所以就抛出异常了NumberFormatException[/quote]
name中含有非数字吧[/quote]
都别扯可好,可用过?
你看到源码上把那个异常打印出来了?抛出来了?没看到Ignore啊。
这个方法的作用本身就是通过文件名查到资源id的。还说得像真的一样。
你把异常信息贴出来。就你那样的描述,不清楚。从drawable调用资源的方法! resourses.getIdentifier这个方法是干嘛的
public int getIdentifier(String name, String defType, String defPackage) {
if (name == null) {
throw new NullPointerException("name is null");
}
try {
return Integer.parseInt(name);
} catch (Exception e) {
// Ignore
}
return mAssets.getResourceIdentifier(name, defType, defPackage);
}
第一个参数会调用 Integer.parseInt(name);
所以就抛出异常了NumberFormatExceptionresourses.getIdentifier这个方法是干嘛的
我是想把他们转换成字符串啊,没有要转换成数字啊!??