There are two ways to share third parties:
1. The need to integrate the official SDK package, the official authorization after the call of its API to complete the share of micro-trust, microblogging and so on.
Benefits: Seamless integration, multiple functions
Disadvantage: Integration of the official SDK package for development and requires an official authorization
2. Direct transfer of micro-trust, micro-blogging and other activity to share
Advantages: And simple, without the need for SDK and official authorization
Disadvantages: Local need to install micro-letter, microblogging client
Here I introduce the second way of sharing, which is used in the application of the Gem and Android version of the machine.
The typical code is as follows:
@Override public
void OnClick (View v)
{
String pakname = "";
Intent Intent = new Intent (intent.action_send); Start sharing the Sent properties
intent.settype ("Text/plain");//share sent data type
switch (V.getid ())
{case
0:
pakname = " Com.qzone "; QQ space break
;
Case 1:
pakname = "Com.tencent.WBlog";//Tencent micro Bo break
;
Case 2:
pakname = "com.tencent.mm";//micro-letter break
;
Default: Break
;
}
Intent.setpackage (pakname);
Intent.putextra (Intent.extra_subject, "Here is the topic of sharing"); Shared Theme
Intent.putextra (Intent.extra_text, "Here is sharing content");//share Content
this.startactivity (intent.createchooser (Intent, "")); /Target Application selection dialog box title;
It's also easy to make your own activity support this invocation, as long as you add the XML
<intent-filter>
<action android:name= "Android.intent.action.SEND"/>
<category android: Name= "Android.intent.category.DEFAULT"/>
</intent-filter>
Can.
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.