android跳转到微信app
public class JumpWechatActivity extends BaseActivity {
private String pasteText;
private String toastText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_jump_wechat);
if (getIntent().getData() != null) {
pasteText = getIntent().getData().getQueryParameter("pasteText");
toastText = getIntent().getData().getQueryParameter("toastText");
}
try {
ClipboardManager cmb = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
cmb.setPrimaryClip(ClipData.newPlainText("simple_text", StringUtils.isNotEmpty(pasteText) ? pasteText : getString(R.string.huanbei_weixin_wechat)));
ToastUtil.show(JumpWechatActivity.this, StringUtils.isNotEmpty(toastText) ? toastText : Html.fromHtml(getString(R.string.copy_weixin_public)).toString(), Toast.LENGTH_SHORT);
Intent intent = getPackageManager().getLaunchIntentForPackage("com.tencent.mm");
startActivity(intent);
} catch (Exception e) {
ToastUtil.show(JumpWechatActivity.this, Html.fromHtml(getString(R.string.weixin_jump_error)).toString(), Toast.LENGTH_SHORT);
}
finish();
}
}