我XmlResourceParser
用来从元素中提取值。我使用msgBody= xmlResourceParser.nextText();
which 从 Message 元素 iei'm glad that you came to see me
和Sorry wrong number
. 我只想从顶部得到一个,我怎样才能得到它?我的 xml 文件如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<Messages>
<Contact Name="Tomas" Number="079399877339">
<Message Date="30 Jan 2012" Time="23:36">i'm happy that you go to see her</Message>
<Message Date="31 Jan 2012" Time="11:34">this is a sample message</Message>
</Contact>
</Messages>
.getText()
抛出 NullPointerException。