hi,

How can i read all the messages from sim as well as phone.

I have tried the below code but not success yet.

 public static void getAllSMS(Context context)
   {
           try
           {
                   Uri allMessage = Uri.parse("content://sms/");
                   ContentResolver cr = context.getContentResolver();
                   Cursor cursor = cr.query(allMessage, null, null, null, null);
                   int count = cursor.getCount();
                   if (count > 0)
                   {
        
cursor.moveToFirst();
                           long messageId = cursor.getLong(0);
                           long threadId = cursor.getLong(1);
                           String address = cursor.getString(2);
                           long contactId = cursor.getLong(3);
                           String contactId_string = String.valueOf(contactId);
                           long timestamp = cursor.getLong(4);
                           String body = cursor.getString(5);
                   }


           }
           catch (Exception e)
           {
                   e.printStackTrace();
           }
   }

and for email and calendar events ?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to