为何我的一闪就返回了,并没有分享出去
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_send_to_wx);
api = WXAPIFactory.createWXAPI(this, MainActivity.WX_APP_ID, false);
api.registerApp(MainActivity.WX_APP_ID);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_send_to_wx, menu);
return true;
}
private String buildTransaction(final String type) {
return (type == null) ? String.valueOf(System.currentTimeMillis()) : type + System.currentTimeMillis();
}
public void send_text_to_wx(View view) {
WXTextObject textObject = new WXTextObject();
textObject.text = "来自测试";
WXMediaMessage msg = new WXMediaMessage();
msg.title = "测试Title";
msg.mediaObject = textObject;
msg.description = "藐视";
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = buildTransaction("text");
req.message = msg;
req.scene = SendMessageToWX.Req.WXSceneSession;
api.sendReq(req);
finish();
}