Android获取收件箱列表与会话内容

直接上代码了

1.获取收件箱列表

 public void openInbox() { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setData(Uri.parse("content://mms-sms/")); startActivity(intent); }

效果:

Android获取收件箱列表与会话内容_第1张图片

2.获取会话内容

  public static final Uri CONTENT_URI = Uri.parse("content://mms-sms/"); public static final Uri CONVERSATIONS_URI = Uri.withAppendedPath(CONTENT_URI,"conversations"); private void openThread(long threadId) { startActivity(createIntent(this, threadId)); } public static Intent createIntent(Context context, long threadId) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(getUri(threadId)); return intent; } public static Uri getUri(long threadId) { // TODO: Callers using this should really just have a Conversation // and call getUri() on it, but this guarantees no blocking. return ContentUris.withAppendedId(CONVERSATIONS_URI, threadId); }

效果:

Android获取收件箱列表与会话内容_第2张图片

 

你可能感兴趣的:(android)