예제 #1
0
  public void shareWebMessage(
      String shareUrl, String title, String description, Drawable mDrawable) {
    WeiboMultiMessage weiboMessage = new WeiboMultiMessage();
    if (mDrawable == null) mDrawable = context.getResources().getDrawable(R.drawable.ic_launcher);
    BitmapDrawable bitmapDrawable = (BitmapDrawable) mDrawable;
    Bitmap shareBitmap = null;
    try {
      shareBitmap = bitmapDrawable.getBitmap();
      if (shareBitmap == null)
        shareBitmap =
            ((BitmapDrawable) context.getResources().getDrawable(R.drawable.ic_launcher))
                .getBitmap();
      else shareBitmap = zoomImg(shareBitmap, 100);
      weiboMessage.mediaObject = getWebpageObj(shareUrl, title, description, shareBitmap);
      weiboMessage.textObject = getTextObj(title);
      SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
      request.transaction = String.valueOf(System.currentTimeMillis());
      request.multiMessage = weiboMessage;
      mWeiboShareAPI.sendRequest(request);
    } catch (Exception e) {

    } finally {
      if (shareBitmap != null) {
        // shareBitmap.recycle();
        shareBitmap = null;
      }
    }
  }
예제 #2
0
 public void shareMultiMessage(String shareTxt, Drawable mDrawable) {
   WeiboMultiMessage weiboMessage = new WeiboMultiMessage();
   if (!shareTxt.equals("")) {
     weiboMessage.textObject = getTextObj(shareTxt);
   }
   if (mDrawable != null) {
     weiboMessage.imageObject = getImageObj(mDrawable);
   }
   SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
   request.transaction = String.valueOf(System.currentTimeMillis());
   request.multiMessage = weiboMessage;
   mWeiboShareAPI.sendRequest(request);
 }