I want to read all the messages and their respective details from my phone. For this I am using the Uri like this:
Uri sms = Uri.parse("content://sms/");
But I don't know how many columns in database which are associated with this uri.
I want to display the following information:
Please can anybody enumerate the total column names?
package com.readsms;
import android.app.Activity; import android.content.ContentResolver; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.util.Log; public class ReadSMS extends Activity { private static final String tag = "Whozzat"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Uri sms = Uri.parse("content://sms/inbox"); ContentResolver cr = this.getContentResolver(); Cursor c = cr.query(sms, null, null, null, null); for (int i = 0; i < c.getColumnCount(); i++) { Log.v(tag, c.getColumnName(i).toString()); } c.close(); } }
after running this code snippet I have got the following columns:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With