我想从收件箱短信中获取地址
我不确定我的问题是否正确。
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());
}
Do like
//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));
阅读更多关于如何从sqlite游标获取列值?