Android calls the sharing function instance code provided by the system

Several ways to realize sharing function

1. Call the sharing function of the system

2. Through third-party SDK, such as sharesdk, Youmeng, etc

3. Use the SDKs of their own platforms, such as QQ, wechat and microblog

Here's the first way.

Share text messages

The effect is as follows:

Share a single picture

Share multiple files

The effect of the above examples is the same. Create a selector to let users choose where to share.

One thing to note here is that this method is used for sharing. The type of data transmitted by intent (i.e. settype() method) must be controlled well, or errors will occur. (as for why to say later).

Since it is a picture in the shared res, it is converted to URI. The method is as follows:

Specify to share to wechat

The effects are as follows:

Specify to share to QQ

The effects are as follows:

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>