【Android API】ShareCompat.IntentBuilder机翻+手翻

1,java.lang.Object
--->> android.support.v4.app.ShareCompat.IntentBuilder
android.support.v4 jar包下。
2,Class Overview 概述
IntentBuilder is a helper for constructing ACTION_SEND and ACTION_SEND_MULTIPLE sharing intents and starting activities to share content. The ComponentName and package name of the calling activity will be included.
IntentBuilder 构造一个ACTION_SEND和ACTION_SEND_MULTIPLE 分享意图并且开启activity的帮助类,用来分享内容。调用activity的单元和包名也将包括在内。
3, Public Methods 公共方法
1:public ShareCompat.IntentBuilder addEmailBcc (String[] addresses)
Add an array of email addresses to be used in the "bcc" field of the final Intent.
添加一个bcc(复制密件 - blind carbon copied)的邮件地址数组到意图。
Parameters
addresses Email addresses to BCC
用来抄送的Email。
Returns
This IntentBuilder for method chaining
返回一个IntentBuilder的方法链接。
2:public ShareCompat.IntentBuilder addEmailBcc (String address)
同“1”,这里的参数不是数组,而是一个邮件地址字符串;
3:public ShareCompat.IntentBuilder addEmailCc (String[] addresses)

Add an array of email addresses to be used in the "cc" field of the final Intent.
添加一个cc(抄送 - carbon copied)的邮件地址数组到意图。
Parameters
addresses Email addresses to CC
Returns
This IntentBuilder for method chaining
4:public ShareCompat.IntentBuilder addEmailCc (String address)
同“3”,参数为字符串;
5:public ShareCompat.IntentBuilder addEmailTo (String[] addresses)
Add an array of email addresses to be used in the "to" field of the final Intent.
添加一个群发邮件地址数组到意图。
Parameters
addresses Email addresses to send to
Returns
This IntentBuilder for method chaining
6:public ShareCompat.IntentBuilder addEmailCc (String address)
同“5”
7:public ShareCompat.IntentBuilder addStream (Uri streamUri)

Add a stream URI to the data that should be shared. If this is not the first stream URI added the final intent constructed will become an ACTION_SEND_MULTIPLE intent. Not all apps will handle both ACTION_SEND and ACTION_SEND_MULTIPLE.
添加要共享的数据流的URI。如果这不是第一个被添加到意图的流,那么这个意图会是一个ACTION_SEND_MULTIPLE意图。
并不是所有应用将同时持有ACTION_SEND,ACTION_SEND_MULTIPLE.
Parameters
streamUri URI of the stream to share 要分析的数据流的URI
Returns
This IntentBuilder for method chaining
ACTION_SEND:
Activity Action: Deliver some data to someone else. Who the data is being delivered to is not specified; it is up to the receiver of this action to ask the user where the data should be sent.
活动的动作,提供一些数据去其他人。数据被提供给谁并没有被指定,这决定于接收者的动作的要求,这些数据应该被发送给谁。
When launching a SEND intent, you should usually wrap it in a chooser (through createChooser(Intent, CharSequence)), which will give the proper interface for the user to pick how to send your data and allow you to specify a prompt indicating what they are doing.
当启动一个意图,你通常应该把它包含在一个选择器中(通过creatChooser(Intent,CharSequence))方法),这将给用户一个合适的接口去选择怎样把你的数据发送,并且允许你指定一个提示表示他们在做什么。
Input: getType() is the MIME type of the data being sent. get*Extra can have either a EXTRA_TEXT or EXTRA_STREAM field, containing the data to be sent. If using EXTRA_TEXT, the MIME type should be "text/plain"; otherwise it should be the MIME type of the data in EXTRA_STREAM. Use */* if the MIME type is unknown (this will only allow senders that can handle generic data streams). If using EXTRA_TEXT, you can also optionally supply EXTRA_HTML_TEXT for clients to retrieve your text with HTML formatting.
输入:getType()是将被发送的数据的MIME类型。
get*Extra()可以有EXTRA_TEXT或EXTRA_STREAM字段,包含要发送的数据;
如果使用EXTRA_TEXT,MIME类型应该是"text/plain";否则MIME类型是EXTRA_STREAM.
使用*/*如果MIME的类型未知(这将仅仅允许发送者只能处理一般的数据流);
如果使用EXTRA_TEXT,你也可以为用户提供EXTRA_HTML_TEXT,从html中获取文字。
As of JELLY_BEAN, the data being sent can be supplied through setClipData(ClipData). This allows you to use FLAG_GRANT_READ_URI_PERMISSION when sharing content: URIs and other advanced features of ClipData. If using this approach, you still must supply the same data through the EXTRA_TEXT or EXTRA_STREAM fields described below for compatibility with old applications. If you don't set a ClipData, it will be copied there for you when calling startActivity(Intent).
和4.0一样,将发送的数据可以通过setClipData(ClipData)来提供。这允许你在分享的时候,使用FLAG_GRANT_READ_URI_PERMISSION,URI和其他先进功能。若使用这种方法,你必须通过下文所述的与旧应用程序的兼容性EXTRA_TEXT或EXTRA_STREAM领域提供相同的数据。如果你没有设置ClipData,他将被复制在那,当你开启活动的时候。
Optional standard extras, which may be interpreted by some recipients as appropriate, are: EXTRA_EMAIL, EXTRA_CC, EXTRA_BCC, EXTRA_SUBJECT.
可选的额外标准:EXTRA_EMAIL,EXTRA_CC,EXTRA_BCC,EXTRA_SUBJECT;
8: public 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.
创建一个意图,将推出标准的android活动选择器,允许选择什么样的安装在系统上的activity/app处理分享。
Returns
A chooser Intent for the currently configured sharing action
9:public static ShareCompat.IntentBuilder from (Activity launchingActivity)
Create a new IntentBuilder for launching a sharing action from launchingActivity.
从当前上下文,创建一个新的IntentBuilder去执行分享动作。
10:public Intent getIntent ()
Retrieve the Intent as configured so far by the IntentBuilder. This Intent is suitable for use in a ShareActionProvider or chooser dialog.
检索所有由IntentBuilder配置的意图。该意图适用在ShareActionProvider或chooser dialog;
To create an intent that will launch the activity chooser so that the user may select a target for the share, see createChooserIntent().
要创建一个意图去启动activity选择器,使用户可以选择目标去分享,见creatChooserIntent();
11:public ShareCompat.IntentBuilder setChooserTitle (int resId)
Set the title that will be used for the activity chooser for this share.
设置将被使用的activity 选择器的title。
12:public ShareCompat.IntentBuilder setEmailBcc (String[] addresses)
Set an array of email addresses to BCC on this share. This replaces all current "BCC" recipients that have been set so far.
见“1”;
13:public ShareCompat.IntentBuilder setEmailCc (String[] addresses)
见“3”
14:public ShareCompat.IntentBuilder setEmailTo (String[] addresses)
见“5”
15:public ShareCompat.IntentBuilder setHtmlText (String htmlText)
Set an HTML string to be sent as part of the share. If 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.
设置Html字符串为将要发出的分享的一部分。如果EXTRA_TEXT没有被提供,一个支持Html的并且被Html.fromHtml解析的文本样式版本将要被添加为EXTRA_TEXT。
16:public ShareCompat.IntentBuilder setStream (Uri streamUri)
Set a stream URI to the data that should be shared.
设置要分析的数据流的URI。
This replaces all currently set stream URIs and will produce a single-stream ACTION_SEND intent.
这将替换当前所有设置的流的URI,并且将产生一个单流ACTION_SEND意图。
17:public ShareCompat.IntentBuilder setSubject (String subject)
Set a subject heading for this share; useful for sharing via email.
设置一个共享的主题词,对电子邮件分享很有用。
18:public ShareCompat.IntentBuilder setText (CharSequence text)
Set the literal text data to be sent as part of the share. This may be a styled CharSequence.
设置文字数据作为分享的一部分。这也许是个格式化的CharSequence。
19:public ShareCompat.IntentBuilder setType (String mimeType)
Set the type of data being shared
设置要分享的数据的type。
20:public void startChooser ()
Start a chooser activity for the current share intent.
为当前分享意图开启选择activity。
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.
请注意,在大多数情况下,你应该使用ShareCompat.configureMenuItem()来添加一个分享条目到menu并且呈现一个详细视图。
而不是直接调用此方法。

posted @ 2014-04-03 17:00  风景线外  阅读(1448)  评论(0编辑  收藏  举报