Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>thanks a lot i have try <code>save_draft()</code> try this and insert into <code>inbox/sent/draft</code> etc....</p> <pre><code>public class AddData { Activity act; Context ctx,context; ContentResolver cr; public AddData(Activity act) { cr = act.getContentResolver(); this.act = act; } public void addsms(String address,String body,String date,String type,String read) { String[] addr = address.split(" "); String thread_id = save_draft(addr); ContentValues values = new ContentValues(); values.put("body", body); values.put("date", date); values.put("type", type); if(type.equals("3")) { values.put("thread_id", thread_id); }else { values.put("address", address); } Uri uri = cr.insert(Uri.parse("content://sms/"), values); cr.notifyChange(uri, null); } protected String save_draft(String[] recipients) { Uri threadIdUri = Uri.parse("content://mms-sms/threadID"); Uri.Builder builder = threadIdUri.buildUpon(); for (String recipient : recipients) { builder.appendQueryParameter("recipient", recipient); } Uri uri = builder.build(); String thread_id = get_thread_id(uri).toString(); Log.d("thread_id", thread_id + " "); //^tried "content://sms/" as well, but got the same result return thread_id; } private Long get_thread_id(Uri uri) { long threadId = 0; Cursor cursor = act.getContentResolver().query(uri, new String[] { "_id" }, null, null, null); if (cursor != null) { try { if (cursor.moveToFirst()) { threadId = cursor.getLong(0); } } finally { cursor.close(); } } return threadId; } </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload