将收到的坐标存储到 SQLite 数据库
Storing received Coordinates to a SQLite Database
我的 phone 号码收到 LAT 和 LONG 的短信。示例文本:
纬度:23.424076
长:53.847818
我看到了关于如何将这些数据传递到 SQLite 数据库的教程。但是,它会读取所有传入的消息。我想从一个数字中获取这些数据。
在 table 上有 3 列。一个用于地址、日期和正文。我想让我的应用程序识别正文(消息)是否有纬度和经度,并获取浮点数,并将其放在我的 table.
上的单独列中
令人困惑。你能告诉我应该怎么做吗?
考虑到您将始终收到消息文本 "LAT: " 和 "LONG: "
String str = "LAT: 23.424076 LONG: 53.847818";
String[] splits = str.split("LAT: | LONG: ");
//test with
for(String s : splits)
System.out.println(s);
//Do your necessary jobs with the values over here
我的 phone 号码收到 LAT 和 LONG 的短信。示例文本:
纬度:23.424076 长:53.847818
我看到了关于如何将这些数据传递到 SQLite 数据库的教程。但是,它会读取所有传入的消息。我想从一个数字中获取这些数据。
在 table 上有 3 列。一个用于地址、日期和正文。我想让我的应用程序识别正文(消息)是否有纬度和经度,并获取浮点数,并将其放在我的 table.
上的单独列中令人困惑。你能告诉我应该怎么做吗?
考虑到您将始终收到消息文本 "LAT: " 和 "LONG: "
String str = "LAT: 23.424076 LONG: 53.847818";
String[] splits = str.split("LAT: | LONG: ");
//test with
for(String s : splits)
System.out.println(s);
//Do your necessary jobs with the values over here