如何打开 gmail 应用程序,而不是消息发送屏幕?

How to open gmail app, not message send screen?

我想在单击按钮时打开我的 gmail 应用程序。它到处都展示了如何使用 Intent.ACTION_SEND 通过 gmaial 发送消息。但我不想发送消息。相反,我只想启动我的 gmail 应用程序并查看我的消息列表。我该怎么做?也许我必须找到包名并启动应用程序,或者有其他更好的解决方案?

这是你的答案

Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.google.android.gm");
if (launchIntent != null) {
    startActivity(launchIntent);
} else {
    Toast.makeText(AccountActivity.this, "There is no Gmail App available in android", Toast.LENGTH_LONG).show();
}