title: Want to delete the messages of a specific number from the INBOX of android
body: <p>I want to delete the messages from a specific mobile no. in android phone.
  For this,I am using the following code..</p>
  
  <p>The Problem in this code is that it is deleting all the conversations from the phone..
  So help me please to resolve this problem.
  THANX IN ADVANCE...</p>
  
  <pre><code>public class MainActivity extends Activity
  </code></pre>
  
  <p>{</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState)
  {
  //  String specificPhoneNumber = "+91" ;
  
      super.onCreate(savedInstanceState);
      long V;
      MainActivity thr = new MainActivity();
      V =thr.getThreadId(thr);
      Uri thread = Uri.parse("content://sms/inbox/8767564523" + V);
  
  
          getContentResolver().delete(thread, null, null);
  
  
  }
  
  
  private long getThreadId(Context context)
      {
          long threadId = 0;
  
          String SMS_READ_COLUMN = "read";
          String WHERE_CONDITION = SMS_READ_COLUMN + " = 0";
          String SORT_ORDER = "date DESC";
          int count = 0;
          Uri uri1 = Uri.parse("content://sms/inbox/");
          Cursor cursor = context.getContentResolver().query(uri1,new String[] { "_id", "thread_id", "address", "person", "date", "body" },WHERE_CONDITION,null,SORT_ORDER);
  
          if (cursor != null) {
                  try {
                      count = cursor.getCount();
                      if (count &gt; 0) {
                          cursor.moveToFirst();
                          threadId = cursor.getLong(1);                              
                      }
                  } finally {
                          cursor.close();
                  }
          }
  
  
          return threadId;
      }
  </code></pre>
  
  <p>}   </p>