标签:
public class MainActivity extends Activity { private TextView tv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // 首先在您的Activity中添加如下成员变量 final UMSocialService mController = UMServiceFactory.getUMSocialService("com.umeng.share"); // 设置分享内容 mController.setShareContent("友盟社会化组件(SDK)让移动应用快速整合社交分享功能,http://www.umeng.com/social"); // 设置分享图片, 参数2为图片的url地址 mController.setShareMedia(new UMImage(getApplicationContext(), "http://www.baidu.com/img/bdlogo.png")); tv=(TextView) findViewById(R.id.tv); //参数1为当前Activity, 参数2为开发者在QQ互联申请的APP ID,参数3为开发者在QQ互联申请的APP kEY. UMQQSsoHandler qqSsoHandler = new UMQQSsoHandler(this, "100424468", "57035adee0f55a33f0000227"); qqSsoHandler.addToSocialSDK(); //参数1为当前Activity, 参数2为开发者在QQ互联申请的APP ID,参数3为开发者在QQ互联申请的APP kEY. QZoneSsoHandler qZoneSsoHandler = new QZoneSsoHandler(this, "100424468", "57035adee0f55a33f0000227"); qZoneSsoHandler.addToSocialSDK(); tv.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub mController.setShareMedia(new UMImage(getApplicationContext(), "http://www.baidu.com/img/bdlogo.png")); mController.openShare(MainActivity.this, false); } }); } }
<!-- ############ QQ空间和QQ SSO授权的Activity注册 ############ --> <activity android:name="com.tencent.tauth.AuthActivity" android:launchMode="singleTask" android:noHistory="true" > <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="tencent你的QQ互联APPID" /> </intent-filter> </activity>
标签:
原文地址:http://www.cnblogs.com/yr520/p/5355175.html