我想从收件箱短信中获取地址
我不确定我的查询是否正确。
final String SMS_URI_INBOX = "content://sms/inbox";
Uri uri = Uri.parse(SMS_URI_INBOX);
String[] projection = new String[] { "_id", "address", "person", "body", "date", "type" };
Cursor cur = getContentResolver().query(uri, projection, "address='?'", null, "address ASC");
List<String> spinnerArray = new ArrayList<String>();
if (cur.moveToFirst())
{
do
{
//How to get address
spinnerArray.add(address);
} while (cur.moveToNext());
}
答案 0 :(得分:0)
喜欢
//How to get address
spinnerArray.add(cur.getString(cur.getColumnIndex("address")));
// OR position of address column into projection is at 2 so you can pass
// direct.
spinnerArray.add(cur.getString(1));