我想过滤带有前缀“kmsmks”的消息,编译成功但我强制关闭:
...
String firstword = "kmsmks";
while (cursor.moveToNext())
{ String address = cursor.getString(1);
String body = cursor.getString(3);
String firstmessageword = body.substring(0,7);
if (firstword.equals(firstmessageword))
{
System.out.println("======> Mobile number => "+address);
System.out.println("=====> SMS Text => "+body);
sms.add("Address=> "+address+"\n SMS => "+body);
}
}
return sms;
}
…
原始代码:http ://www.technotalkative.com/android-fetch-inbox-sms/