Retrieve android.intent.extra.EMAIL value from bundle

纵然是瞬间 提交于 2019-12-07 18:05:27

问题


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 .

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

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

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());

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

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


回答1:


Found answer here Passing values through bundle and get its value on another activity

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

Edit:

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


来源:https://stackoverflow.com/questions/42547616/retrieve-android-intent-extra-email-value-from-bundle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!