0

我正在尝试分离 SMS 线程,以便我可以轻松获得最新的短信线程,如下所示:

SMSThread [id=9ccf49ec18f8f2b46e9aadbf2d07d1c57f162bd5, title=, date=Sun Mar 17 16:19:23 EDT 2013, contact={id=;name=Taylor;number=+1phonenumber;imageUrl=http://www.google.com/voice/resources/1366864992-blue_ghost.jpg;}, read=false, starred=false, listSms=[

SMS [dateTime=2013 年 3 月 17 日星期日 16:19:00 EDT,来自={id=;name=Contact;number=+1Phonenumber;imageUrl= http://www.google.com/voice/resources/1366864992-blue_ghost。 jpg ;}, text=sup??],

我这样做的方式是有效的,但是当有人给我发逗号或括号时,它只会分隔某些部分......有没有更好的方法来不那么草率地解析它

4

1 回答 1

0

好吧,而不是解析所有线程,您可以使用 get all SMS 方法,如果您想获取最新的文本,您可以这样做:

Collection<SMSThread> smsthreads = v.getSMSThreads();

        SMSThread f = smsthreads.iterator().next();
        Collection<SMS> sms = f.getAllSMS();
        SMS mostrecentsms = sms.iterator().next();

然后只需我们在 SMS 类中的方法来获取所需的信息

于 2013-03-18T01:12:19.127 回答