view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
Intent intent = new Intent(Intent.ACTION_MAIN);
ComponentName cmp = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.LauncherUI");
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setComponent(cmp);
startActivity(intent);
} catch (ActivityNotFoundException e) {
Toast.makeText(MainActivity.this, "您还未安装微信", Toast.LENGTH_SHORT).show();
}
}
});
安卓 点击打开微信
最新推荐文章于 2021-12-31 00:13:07 发布