Android Exception getCause - getMessage

时间:2012-02-22 12:43:31

标签: android exception

使用BitmapFactory.decodeStream函数,我得到以下异常

02-22 13:24:34.129: W/System.err(7927): java.io.FileNotFoundException: toto.jpg

在catch子句中,e.getMessage()生成

toto.jpg

但是如何获得

java.io.FileNotFoundException 

我尝试e.getCause()但它返回null

2 个答案:

答案 0 :(得分:1)

尝试:

exception.toString(); 

查看资源代码,您就会明白

答案 1 :(得分:0)

尝试:

/* ... */
catch(Exception e) {
    String name = e.getClass().getName();
}
相关问题