从包中检索android.intent.extra.EMAIL值 [英] Retrieve android.intent.extra.EMAIL value from bundle

查看:123
本文介绍了从包中检索android.intent.extra.EMAIL值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个类似于电子邮件客户端应用程序的应用程序,例如 Gmail

I created one app like email clients app such as Gmail.

当用户在其他应用程序中单击电子邮件地址并选择我的应用程序时从电子邮件发送应用程序列表中出现。

When user click on email address in another apps and choose my app from email sending apps in list appear on .

电子邮件内容(例如电子邮件地址,电子邮件主题和....)是通过intent进入我的应用的。

The email content like email address , email subject and .... come to my app by intent .

但是问题是 intent.getData(); null 始终保持价值,我尝试从意图获取电子邮件数据。

But the problem is intent.getData(); is null value all of the time and i try to get email data from intent .

我测试了 bundle intent 中,我看到它不为null,并且在我编写此代码时:

I tested bundle in intent and i saw its not null and when i write this code :

bundle = intent.getExtras();
                Log.e("Email",bundle.toString());

bundle.toString()返回 Bundle [{android.intent.extra.EMAIL = [Ljava.lang.String; @ 11cda76c}]

我不知道这是什么 [Ljava.lang.String; @ 11cda76c}] ,如何从这里获取电子邮件地址! ?

I dont know what is this [Ljava.lang.String;@11cda76c}] and how i can get the email address from here ! ?

推荐答案

在此处找到答案通过捆绑传递值并在另一个活动中获取其值

bundle = this.getIntent().getExtras();
String email= bundle.getString("EMAIL");

编辑:

bundle = this.getIntent().getExtras();
String [] emails=bundle.getStringArray(Intent.EXTRA_EMAIL );

这篇关于从包中检索android.intent.extra.EMAIL值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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