package com.exmple.jinritoutiao; import java.util.List; import com.exmple.frage.Fragment_1; import com.exmple.vo.MyData; import com.umeng.socialize.bean.SHARE_MEDIA; import com.umeng.socialize.controller.UMServiceFactory; import com.umeng.socialize.controller.UMSocialService; import com.umeng.socialize.media.UMImage; import com.umeng.socialize.sso.QZoneSsoHandler; import com.umeng.socialize.sso.SinaSsoHandler; import com.umeng.socialize.sso.UMQQSsoHandler; import com.umeng.socialize.sso.UMSsoHandler; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.KeyEvent; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ImageView; public class XiangqingActivity extends Activity { private WebView webview; private ImageView inforepost; private UMSocialService mController; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_xiangqing); mController = UMServiceFactory.getUMSocialService("com.umeng.share"); Intent ints = getIntent(); final String position = ints.getStringExtra("info1"); final String title = ints.getStringExtra("title"); final String image = ints.getStringExtra("im"); webview = (WebView) findViewById(R.id.webview); inforepost = (ImageView) findViewById(R.id.info_img_repost); webview.getSettings().setDefaultTextEncodingName("utf-8"); webview.loadUrl(position); webview.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideKeyEvent(WebView view, KeyEvent event) { // TODO Auto-generated method stub return super.shouldOverrideKeyEvent(view, event); } }); inforepost.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mController.setShareContent(title+","+position ); // 设置分享图片, 参数2为图片的url地址 mController.setShareMedia(new UMImage(XiangqingActivity.this, "http://pb2.pstatp.com/list/417000f837fdef32d52")); /* mController.setShareMedia(new UMImage(XiangqingActivity.this, image));*/ //mController.setShareMedia(new UMImage(XiangqingActivity.this, R.drawable.ic_tip_code)); /* * mController.setShareImage(new UMImage(XiangqingActivity.this, * )); */ mController.getConfig().removePlatform(SHARE_MEDIA.RENREN, SHARE_MEDIA.DOUBAN); mController.openShare(XiangqingActivity.this, false); } }); UMQQSsoHandler qqSsoHandler = new UMQQSsoHandler( XiangqingActivity.this, "100424468", "56e8bcc767e58e4ada001741"); qqSsoHandler.addToSocialSDK(); QZoneSsoHandler qZoneSsoHandler = new QZoneSsoHandler( XiangqingActivity.this, "100424468", "56e8bcc767e58e4ada001741"); qZoneSsoHandler.addToSocialSDK(); // 设置新浪SSO handler mController.getConfig().setSsoHandler(new SinaSsoHandler()); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); /** 使用SSO授权必须添加如下代码 */ UMSsoHandler ssoHandler = mController.getConfig().getSsoHandler( requestCode); if (ssoHandler != null) { ssoHandler.authorizeCallBack(requestCode, resultCode, data); } } }