Bitmap BMP=BitmapFactory. DecodeResource (context) getResources (), R.m ipmap. Ic_launcher);
WXImageObject imgObj=new WXImageObject (BMP);
Final WXMediaMessage MSG=new WXMediaMessage ();
MSG. MediaObject=imgObj;
MSG. The title=the title;
MSG. The description=desc;
//final Bitmap [] thumbBmp={Bitmap. CreateScaledBitmap (BMP, 150, 150, true)};
//BMP. Recycle ();
New Thread (new Runnable () {
@ Override
Public void the run () {
Try {
InputStream imageStream=getImageStream (imgUrl);
Bitmap Bitmap=BitmapFactory. DecodeStream (imageStream);
MSG. MediaObject=new WXImageObject (bitmap);
//thumbBmp [0]=Bitmap. CreateScaledBitmap (Bitmap, 150, 150, true);
Bitmap. Recycle ();
} the catch (Exception e) {
e.printStackTrace();
}
//MSG. ThumbData=https://bbs.csdn.net/topics/bmpToByteArray (thumbBmp [0], true);
SendMessageToWX. The Req the Req=new SendMessageToWX. The Req ();
The req. Transaction=buildTransaction (" img ");
The req. Message=MSG;
The req. Scene=wxSceneSession;
API. SendReq (the req);
}
}).start();
[code=Java]}
[/code]