In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to share pure pictures to Qzone in android". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to share pure pictures to Qzone in android.
The native implementation of Wechat friend sharing:
Public static void sharedToWx (Context context,Uri uri,String filePath) {if (sendMsg = = null) return; Intent intent = new Intent (Intent.ACTION_SEND); if (! (context instanceof Activity)) {intent.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK);} / / intent.setType ("text/plain"); / / text sharing intent.setType ("image/*"); if (uri! = null) {intent.putExtra (Intent.EXTRA_STREAM, uri) } else {intent.putExtra (Intent.EXTRA_STREAM, filePath);} intent.setPackage ("com.tencent.mm"); intent.setClassName ("com.tencent.mm", "com.tencent.mm.ui.tools.ShareImgUI"); / / Wechat context.startActivity (intent);}
(3) native sharing on Wechat moments
Public static void sharedToWx (Context context,Uri uri,String filePath) {if (sendMsg = = null) return; Intent intent = new Intent (Intent.ACTION_SEND); if (! (context instanceof Activity)) {intent.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK);} / / intent.setType ("text/plain"); / / text sharing intent.setType ("image/*"); if (uri! = null) {intent.putExtra (Intent.EXTRA_STREAM, uri) } else {intent.putExtra (Intent.EXTRA_STREAM, filePath);} intent.setPackage ("com.tencent.mm"); intent.setClassName ("com.tencent.mm", "com.tencent.mm.ui.tools.ShareToTimeLineUI"); / / Wechat moments context.startActivity (intent);}
Note: Wechat sdk sharing picture and text sharing method, picture + text size can not exceed 32KB, more than 32KB can not share.
two。 Share qq and Qzone
Note: qq sharing supports native sharing as well as sdk sharing. Qzone, since the activity of Qzone's page is not open to the public, Qzone sharing only supports sdk sharing, not native Qzone sharing. And Qzone sharing early supported pure picture sharing, but google started with android4.0 and turned off the automatic acquisition of apn permissions. If you use qq sharing sdk to share pure pictures to Qzone, you will throw no permission to write apn setting or share failure.
(1) qq shares the text of sdk lawsuit
(2) QQ sharing native implementation
Public static void sharedToWx (Context context,Uri uri,String filePath) {if (sendMsg = = null) return; Intent intent = new Intent (Intent.ACTION_SEND); if (! (context instanceof Activity)) {intent.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK);} / / intent.setType ("text/plain"); / / text sharing intent.setType ("image/*"); if (uri! = null) {intent.putExtra (Intent.EXTRA_STREAM, uri) } else {intent.putExtra (Intent.EXTRA_STREAM, filePath);} intent.setPackage ("com.tencent.mobileqq"); intent.setClassName ("com.tencent.mobileqq", "com.tencent.mobileqq.activity.JumpActivity"); / / QQ context.startActivity (intent);}
(3) use qq to share sdk and share pure pictures directly with Qzone.
Remarks: to share pure pictures to Qzone, sharing sdk actually does not support pure picture sharing, but you can use to share pure pictures to qq, set up to automatically open Qzone, this will pop up a box to share pure pictures, there is a high probability that the sharing will be successful, the picture is not too large, and the possibility of success in sharing too large will be reduced.
Public static void shareToQQZoneImg (String localImgUrl) {if (TextUtils.isEmpty (localImgUrl) | | shareBean = = null) return; Tencent tencent = Tencent.createInstance ("QQ_APP_ID", ApplicatonContext); / / to apply for appid Bundle bundle = new Bundle () from Tencent platform; bundle.putInt (QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_IMAGE) / / Note: to share pure pictures with Qzone, you can only pass these three parameters, not other bundle.putString (QQShare.SHARE_TO_QQ_IMAGE_LOCAL_URL,localImgUrl); / / localImgUrl must be the local mobile phone image address bundle.putInt (QQShare.SHARE_TO_QQ_EXT_INT, QQShare.SHARE_TO_QQ_FLAG_QZONE_AUTO_OPEN); tencent.shareToQQ (Activity, bundle, ShareListener) } at this point, I believe you have a deeper understanding of "how to share pure pictures to Qzone in android". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 272
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.