简体   繁体   中英

Columns name of SMS Cursor?

I have 2 lines code:

private static final Uri SMS_INBOX = Uri.parse("content://sms/inbox"); 
Cursor c = getContentResolver().query(SMS_INBOX, null, null, null, null);

Where to find column list of this cursor?

Yes:)

private static final Uri SMS_INBOX = Uri.parse("content://sms/inbox");
Cursor c = getContentResolver().query(SMS_INBOX, null, null, null, null);
android.util.Log.i("COLUMNS", Arrays.toString(c.getColumnNames()));

And the answer is:

05-27 09:27:39: INFO/COLUMNS: [_id, thread_id, address, person, date, protocol,
read, status, type, reply_path_present, subject, body, service_center, locked]

This, BTW, is the exact table structure of table SMS in MMSSMS database - connect DDMS to the emulator and use FileExplorer to get the whole database from:

data/data/com.android.provider.telephony/databases/mmssms.db

Then use SQLite Database Browser (free) to take a look at the tables. Be sure to simulate one SMS from DDMS so that there is something in the tables, though:)

try using below code

String[] list = cursor.getColumnNames();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM