How to get params from android.intent.action.SEND
I have registered my ac开发者_开发问答tivity in the manifest as android.intent.action.SEND. Now, after pressing SHARE on every app, my application pops - which is great, but I didn't understand how do I fetch the parameters the other app sent to me?
Thanks
The parameters you want to extract are called extras. You can extract them this way:
Bundle extras = this.getIntent().getExtras();
String[] recipients = (String[]) extras.get(EXTRA_EMAIL);
There are several extras you can get from an ACTION_SEND intent (e.g. EXTRA_EMAIL, EXTRA_CC, EXTRA_BCC, EXTRA_SUBJECT). Take a look at the Intent documentation to get an overview
Google provides all the info about it very well explained:
http://developer.android.com/training/sharing/receive.html how to set the manifest, receive the data and check it.
Intent intent = getIntent();
String name = intent.EXTRA_EMAIL.concat(ACCOUNT_SERVICE);
Toast.makeText(this, name, Toast.LENGTH_LONG).show();
精彩评论