自定义分享样式
new ShareAction( this ).setPlatform(SHARE_MEDIA.SINA).setCallback(umShareListener).withText( "hello umeng video" ).withTargetUrl( "http://www.baidu.com" ).withMedia(image).share();
new UMShareListener() { @Override public void onResult(SHARE_MEDIA platform) { Toast.makeText(ShareActivity.this,platform + " 分享成功啦", Toast.LENGTH_SHORT).show(); } @Override public void onError(SHARE_MEDIA platform, Throwable t) { Toast.makeText(ShareActivity.this,platform + " 分享失败啦", Toast.LENGTH_SHORT).show(); } @Override public void onCancel(SHARE_MEDIA platform) { Toast.makeText(ShareActivity.this,platform + " 分享取消了", Toast.LENGTH_SHORT).show(); } };
值得注意的是,分享也应该重写
onActivityResult() @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); UMShareAPI.get( this ).onActivityResult( requestCode, resultCode, data); }
