-->

Retrieve android.intent.extra.EMAIL value from bun

2019-05-17 01:08发布

问题:

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