Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Columns name of SMS Cursor?

Tags:

java

android

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?

like image 269
asedra_le Avatar asked Nov 20 '25 08:11

asedra_le


2 Answers

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 :)

like image 170
Kamen Avatar answered Nov 21 '25 22:11

Kamen


try using below code

String[] list = cursor.getColumnNames();
like image 44
ingsaurabh Avatar answered Nov 21 '25 21:11

ingsaurabh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!