title: How can get sms from android with android studio Java Group By Name or Distinct Name
body: <p>This is my code:</p>
  <pre><code>    ContentResolver cResolver = getContentResolver();
      Cursor smsInboxCursor = cResolver.query(Uri.parse(&quot;content://sms/inbox&quot;),
              null, null, null, null);
  
      int indexBody = smsInboxCursor.getColumnIndex(&quot;body&quot;);
      int indexAddress = smsInboxCursor.getColumnIndex(&quot;address&quot;);
  
      if(indexBody &lt; 0 || !smsInboxCursor.moveToFirst()) return;
  
      arrayAdapter.clear();
      do{
          String str = &quot;SMS from : &quot; + smsInboxCursor.getString(indexAddress) + &quot;\n&quot;;
          str += smsInboxCursor.getString(indexBody);
          arrayAdapter.add(str);
      }while (smsInboxCursor.moveToNext());
  </code></pre>
  <p>i want group them in one name i searched of group by and i didn't find any solution
  <a href="https://i.stack.imgur.com/MRTcK.png" rel="nofollow noreferrer">this is the result</a></p>