gpt4 book ai didi

android - 如何以编程方式打开和显示手机的消息收件箱..?

转载 作者:行者123 更新时间:2023-11-29 16:16:50 25 4
gpt4 key购买 nike

当我们点击邮件时,我们会看到收件箱。

我想在单击我的应用程序按钮时显示相同的窗口。

所以,我想开始消息收件箱 Activity 。

如何实现这个……?

提前致谢...!

最佳答案

试试这个.. 完美..!

public void openInbox() {
String application_name = "com.android.mms";
try {
Intent intent = new Intent("android.intent.action.MAIN");
intent.addCategory("android.intent.category.LAUNCHER");

intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
List<ResolveInfo> resolveinfo_list = this.getPackageManager()
.queryIntentActivities(intent, 0);

for (ResolveInfo info : resolveinfo_list) {
if (info.activityInfo.packageName
.equalsIgnoreCase(application_name)) {
launchComponent(info.activityInfo.packageName,
info.activityInfo.name);
break;
}
}
} catch (ActivityNotFoundException e) {
Toast.makeText(
this.getApplicationContext(),
"There was a problem loading the application: "
+ application_name, Toast.LENGTH_SHORT).show();
}
}

private void launchComponent(String packageName, String name) {
Intent launch_intent = new Intent("android.intent.action.MAIN");
launch_intent.addCategory("android.intent.category.LAUNCHER");
launch_intent.setComponent(new ComponentName(packageName, name));
launch_intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(launch_intent);
}

关于android - 如何以编程方式打开和显示手机的消息收件箱..?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8711940/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com