2011-11-07 48 views

回答

1

你可以尝试这样的事情(来获得目标地址和SMS的身体):

private Cursor smsQuerty() { 
      Uri query_content_uri = Uri.parse("content://sms/sent"); 

     String[] projection = new String[] { "_id", "address", "body" }; 

     Cursor tCursor = getContentResolver().query(query_content_uri, 
       projection, null, null, null); 
     startManagingCursor(tCursor); 

        return tCursor; 
    } 

不是LOG光标看到的数据...例如:

private void logCursorForTesting(Cursor cursor) { 
    int colCount = cursor.getColumnCount(); 
    Log.d(TAG, "Column count is: " + colCount); 

    if (cursor != null && cursor.moveToFirst()) { 
     while(cursor.moveToNext()) { 
      for (int i = 0; i < colCount; i ++) { 
       Log.d(TAG, "## >> " + cursor.getString(i)); 
      } 
      Log.d(TAG, "---------------"); 
     } 
    } 
}