如何打开android的电子邮件收件箱视图 [英] How to open the email inbox view in android

查看:463
本文介绍了如何打开android的电子邮件收件箱视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按我的要求,在点击按钮,我需要打开邮件客户端这在我的设备是可用的。当用户选择特定的邮件客户端,我需要证明他的收件箱,他可以选择特定的电子邮件,他可以发送电子邮件。

打开电子邮件客户端,我已经使用这个特殊的code:

 意向意图=新意图(Intent.ACTION_SEND);
intent.setType(纯/文);
intent.putExtra(Intent.EXTRA_EMAIL,新的String [] {abc@xyz.com});
intent.putExtra(Intent.EXTRA_SUBJECT,主体);
intent.putExtra(Intent.EXTRA_TEXT,邮件正文);
startActivity(Intent.createChooser(意向,));

一旦邮件客户端打开,我需要选择任何特定的邮件客户端,它应该带我到那个特定的应用程序的收件箱,我可以选择任何邮件,并且需要发送。

可以任何机构帮助我如何解决这个问题呢?

感谢。


解决方案

  

当用户选择特定的邮件客户端,我需要证明他的收件箱


有没有标准意图结构显示的电子邮件收件箱。有Android的很多很多的电子邮件应用,但是他们希望每一个都可以做到这一点。

您可以希望做的最好的是:


  • 创建一个 ACTION_SENDTO 意图至mailto: 乌里


  • 使用了意图软件包管理系统 queryIntentActivities()找到支持此,希望他们实际上是从电子邮件客户端的所有活动


  • 找出与这些活动相关的应用程序,从 ResolveInfo 您从找回queryIntentActivities()


  • 使用 getLaunchIntentForPackage()软件包管理系统来找到一些可能的前门每个活动应用程序


  • 创建您自己的选择器样式对话框,允许用户选择的应用程序之一


  • 呼叫 startActivity()意图他们选择了


不过:<​​/ P>


  • 这可能包括非电子邮件应用程序,因为我欢迎编写一个应用程序,提供支持至mailto: 乌里 ACTION_SENDTO


  • 这些应用的前门的活动不一定收件箱



  

他可以选择特定的电子邮件,他可以发送该电子邮件


我不知道这意味着什么。


  

要打开电子邮件客户端,我已经使用这个特殊的code


请注意,您的code有两个缺陷:


  1. 您使用的是无效的MIME类型(纯文本文本/纯,而不是纯/文


  2. 您是不是为选择器提供一个提示


As per my requirement, on click of button, I need to open the mail clients which are available in my device. once the user selects particular mail client,I need to show his inbox and he can select the particular email and he can send that email.

To open email clients i have used this particular code:

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("plain/text");
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "abc@xyz.com" });
intent.putExtra(Intent.EXTRA_SUBJECT, "subject");
intent.putExtra(Intent.EXTRA_TEXT, "mail body");
startActivity(Intent.createChooser(intent, ""));

once the mail clients opens, I need to select any particular mail client and it should take me to that particular application inbox, i can select any mail and need to send.

could any body help me out how to solve this problem ?

Thanks.

解决方案

once the user selects particular mail client,I need to show his inbox

There is no standard Intent structure for showing an email inbox. There are many, many email apps for Android, each of which can do this however they wish.

The best you can hope to do is:

  • Create an ACTION_SENDTO Intent with a mailto: Uri

  • Use that Intent with PackageManager and queryIntentActivities() to find all activities that support this, and hope that they are actually from email clients

  • Find out the applications associated with those activities, from the ResolveInfo you get back from queryIntentActivities()

  • Use getLaunchIntentForPackage() on PackageManager to find some likely "front door" activity for each of the applications

  • Create your own chooser-style dialog to allow the user to choose one of those applications

  • Call startActivity() on the Intent they chose

However:

  • This may include non-email apps, as I am welcome to write an app that offers to support mailto: Uri values with ACTION_SENDTO

  • The "front door" activities of these apps are not necessarily the inbox

he can select the particular email and he can send that email

I have no idea what this means.

To open email clients i have used this particular code

Note that your code has two flaws:

  1. You are using an invalid MIME type (plain text is text/plain, not plain/text)

  2. You are not supplying a prompt for the chooser

这篇关于如何打开android的电子邮件收件箱视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆