Android: How to link sms draft with information about the receiver (like the name)?
if I write a new text message in the Android standard sms app and fill in a receiver and some body text and pr开发者_JAVA百科ess the back button Android will save this as a draft. If the receiver is currently in my address book Android tells me also in the draft overview the name or, if the receiver is not in the address book, the number. So far, so good.
Now I tried to do exactly the same thing on my own and I'm not quite sure why my solution doesn't work. I've tried the following:
// in a Activity
final ContentResolver resolver = getContentResolver();
Cursor cursor = resolver.query(Uri.parse("content://sms/draft"),
String[] {"_id", "date", "body", "person"},
null, null, null);
Later in my own cursor-Adapter I tried to get the person-id which links to the contacts table (I thought so). I do it this way:
// in my own CursorAdapter (bindView-Method)
Long receiverId = cursor.getLong("person");
But what I get is always "0". So what do I do wrong? Thanks in advance.
Btw: Is there any official documentation about the "content://sms"-thing? I only found some forum postings but nothing at developers.android.com!?
精彩评论