public static class ShareCompat.IntentBuilder extends Object
Intent.ACTION_SEND
and
Intent.ACTION_SEND_MULTIPLE
sharing intents and starting activities
to share content. The ComponentName and package name of the calling activity
will be included.Modifier and Type | Method and Description |
---|---|
ShareCompat.IntentBuilder |
addEmailBcc(String address)
Add an email address to be used in the "bcc" field of the final Intent.
|
ShareCompat.IntentBuilder |
addEmailBcc(String[] addresses)
Add an array of email addresses to be used in the "bcc" field of the final Intent.
|
ShareCompat.IntentBuilder |
addEmailCc(String address)
Add an email address to be used in the "cc" field of the final Intent.
|
ShareCompat.IntentBuilder |
addEmailCc(String[] addresses)
Add an array of email addresses to be used in the "cc" field of the final Intent.
|
ShareCompat.IntentBuilder |
addEmailTo(String address)
Add an email address to be used in the "to" field of the final Intent.
|
ShareCompat.IntentBuilder |
addEmailTo(String[] addresses)
Add an array of email addresses to be used in the "to" field of the final Intent.
|
ShareCompat.IntentBuilder |
addStream(Uri streamUri)
Add a stream URI to the data that should be shared.
|
Intent |
createChooserIntent()
Create an Intent that will launch the standard Android activity chooser,
allowing the user to pick what activity/app on the system should handle
the share.
|
static ShareCompat.IntentBuilder |
from(Activity launchingActivity)
Create a new IntentBuilder for launching a sharing action from launchingActivity.
|
Intent |
getIntent()
Retrieve the Intent as configured so far by the IntentBuilder.
|
ShareCompat.IntentBuilder |
setChooserTitle(CharSequence title)
Set the title that will be used for the activity chooser for this share.
|
ShareCompat.IntentBuilder |
setChooserTitle(int resId)
Set the title that will be used for the activity chooser for this share.
|
ShareCompat.IntentBuilder |
setEmailBcc(String[] addresses)
Set an array of email addresses to BCC on this share.
|
ShareCompat.IntentBuilder |
setEmailCc(String[] addresses)
Set an array of email addresses to CC on this share.
|
ShareCompat.IntentBuilder |
setEmailTo(String[] addresses)
Set an array of email addresses as recipients of this share.
|
ShareCompat.IntentBuilder |
setHtmlText(String htmlText)
Set an HTML string to be sent as part of the share.
|
ShareCompat.IntentBuilder |
setStream(Uri streamUri)
Set a stream URI to the data that should be shared.
|
ShareCompat.IntentBuilder |
setSubject(String subject)
Set a subject heading for this share; useful for sharing via email.
|
ShareCompat.IntentBuilder |
setText(CharSequence text)
Set the literal text data to be sent as part of the share.
|
ShareCompat.IntentBuilder |
setType(String mimeType)
Set the type of data being shared
|
void |
startChooser()
Start a chooser activity for the current share intent.
|
public static ShareCompat.IntentBuilder from(Activity launchingActivity)
launchingActivity
- Activity that the share will be launched frompublic Intent getIntent()
To create an intent that will launch the activity chooser so that the user
may select a target for the share, see createChooserIntent()
.
public Intent createChooserIntent()
public void startChooser()
Note that under most circumstances you should use
ShareCompat.configureMenuItem()
to add a Share item to the menu while
presenting a detail view of the content to be shared instead
of invoking this directly.
public ShareCompat.IntentBuilder setChooserTitle(CharSequence title)
title
- Title stringpublic ShareCompat.IntentBuilder setChooserTitle(@StringRes int resId)
resId
- Resource ID of the title string to usepublic ShareCompat.IntentBuilder setType(String mimeType)
mimeType
- mimetype of the shared dataIntent.setType(String)
public ShareCompat.IntentBuilder setText(CharSequence text)
text
- Text to shareIntent.EXTRA_TEXT
public ShareCompat.IntentBuilder setHtmlText(String htmlText)
EXTRA_TEXT
has not already been supplied,
a styled version of the supplied HTML text will be added as EXTRA_TEXT as
parsed by Html.fromHtml
.htmlText
- A string containing HTML markup as a richer version of the text
provided by EXTRA_TEXT.setText(CharSequence)
public ShareCompat.IntentBuilder setStream(Uri streamUri)
This replaces all currently set stream URIs and will produce a single-stream ACTION_SEND intent.
streamUri
- URI of the stream to shareIntent.EXTRA_STREAM
public ShareCompat.IntentBuilder addStream(Uri streamUri)
streamUri
- URI of the stream to shareIntent.EXTRA_STREAM
,
Intent.ACTION_SEND
,
Intent.ACTION_SEND_MULTIPLE
public ShareCompat.IntentBuilder setEmailTo(String[] addresses)
addresses
- Email addresses to send toIntent.EXTRA_EMAIL
public ShareCompat.IntentBuilder addEmailTo(String address)
address
- Email address to send toIntent.EXTRA_EMAIL
public ShareCompat.IntentBuilder addEmailTo(String[] addresses)
addresses
- Email addresses to send toIntent.EXTRA_EMAIL
public ShareCompat.IntentBuilder setEmailCc(String[] addresses)
addresses
- Email addresses to CC on the shareIntent.EXTRA_CC
public ShareCompat.IntentBuilder addEmailCc(String address)
address
- Email address to CCIntent.EXTRA_CC
public ShareCompat.IntentBuilder addEmailCc(String[] addresses)
addresses
- Email addresses to CCIntent.EXTRA_CC
public ShareCompat.IntentBuilder setEmailBcc(String[] addresses)
addresses
- Email addresses to BCC on the shareIntent.EXTRA_BCC
public ShareCompat.IntentBuilder addEmailBcc(String address)
address
- Email address to BCCIntent.EXTRA_BCC
public ShareCompat.IntentBuilder addEmailBcc(String[] addresses)
addresses
- Email addresses to BCCIntent.EXTRA_BCC
public ShareCompat.IntentBuilder setSubject(String subject)
subject
- Subject heading for this shareIntent.EXTRA_SUBJECT