如何打开android的电子邮件收件箱视图 [英] How to open the email inbox view in 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有两个缺陷:
您使用的是无效的MIME类型(纯文本
文本/纯
,而不是纯/文
)您是不是为选择器提供一个提示
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 amailto:
Uri
Use that
Intent
withPackageManager
andqueryIntentActivities()
to find all activities that support this, and hope that they are actually from email clientsFind out the applications associated with those activities, from the
ResolveInfo
you get back fromqueryIntentActivities()
Use
getLaunchIntentForPackage()
onPackageManager
to find some likely "front door" activity for each of the applicationsCreate your own chooser-style dialog to allow the user to choose one of those applications
Call
startActivity()
on theIntent
they choseHowever:
This may include non-email apps, as I am welcome to write an app that offers to support
mailto:
Uri
values withACTION_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:
You are using an invalid MIME type (plain text is
text/plain
, notplain/text
)You are not supplying a prompt for the chooser
这篇关于如何打开android的电子邮件收件箱视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!