reading sms records from database android
<p>I have over 3000 sms on my device. I'm trying to read all messages in the database. I am using this query: </p>

<pre><code>Cursor cur1 = c.getContentResolver().query(Uri.parse("content://sms/"), null, null, null, null);
</code></pre>

<p><code>cur1.getCount()</code> returns all 3000 sms, but when I parse it through a loop it only runs through 400 to 500.</p>

<pre><code>Cursor cur1 = c.getContentResolver().query(Uri.parse("content://sms/"), null, null, null, null);
int size = cur1.getCount();

if(size &gt; 0)
{
    sms = new SMS[size];
    //int i = 0;
    for(int i = 0 ; i &lt; size ; i++)
    {
        cur1.moveToNext();
        ContactInfo p = new ContactInfo();
        String content = cur1.getString(cur1.getColumnIndex("body"));
        String number = cur1.getString(cur1.getColumnIndex("address"));
        long date = cur1.getLong(cur1.getColumnIndex("date"));
        String person = cur1.getString(cur1.getColumnIndex("person"));
        String protocol = cur1.getString(cur1.getColumnIndex("protocol"));
        String name = p.getName(number, c);
        String type = null;

        Calendar cal=Calendar.getInstance();
        cal.clear();
        cal.setTimeInMillis(date);

        String date_time=String.format("%1$te %1$tB %1$tY,%1$tI:%1$tM:%1$tS %1$Tp",cal);

        Log.i("INFO", content+" "+i);

        sms[i] = new SMS(type , name , number , date_time , content );
    }
}
</code></pre>

<p>After 400-500 iterations logcat prints</p>

<pre><code>09-19 20:28:31.148: E/liblog(3153): failed to call dumpstate
09-19 20:28:31.179: I/ActivityManager(3153): Process com.arslan (pid 1766) has died.
</code></pre>
