Java 从收件箱短信中获取地址

Java 从收件箱短信中获取地址,java,android,sms,android-cursor,inbox,Java,Android,Sms,Android Cursor,Inbox,我想从收件箱短信中获取地址 我不确定我的问题是否正确 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

我想从收件箱短信中获取地址 我不确定我的问题是否正确

        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());
        }
喜欢

//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));
阅读更多关于