title: query the latest SMS messages group by contact
body: <p>Like the Message app, the first Activity displays the lastest SMS grouped by person and the count number.</p>
  
  <p>Example I had exchanged 50 texts with Chris, 60 with Aline, 40 with Ray ...
  The app displays something like this</p>
  
  <blockquote>
  <pre><code>Chris (50) Hey how are you lately ?    
  Aline (60) Let's catch up     
  Ray   (40) Here is my number
  Ethan (1)  I wrote a solution
  </code></pre>
  </blockquote>
  
  <p>I'm trying to do the same . I query all the SMS then I sort them.
  At least it's O(n) efficient .</p>
  
  <pre><code>Cursor cur = this.getContentResolver().query(Uri.parse("content://sms"), null, null, null, null);
  int count = cur.getCount();
  
  // iterate all the SMS
  for (int i=1 ; i&lt;=count ; i++){
      // processing
      ....
  
      cur.moveToNext();
  }
  </code></pre>
  
  <p>Is there a way to <strong>query</strong> the latest messages (received or sent no draft type) grouped by person and get the number of SMS from a person ?
  I suppose there are multiple queries.</p>