gpt4 book ai didi

java - Android 启动应用详情页面

转载 作者:太空狗 更新时间:2023-10-29 22:53:50 26 4
gpt4 key购买 nike

我正在开发一个应用程序,我在其中使用包管理器列出已安装的应用程序。我可以获得单击项目的包名称,但我想然后根据包启动详细信息屏幕。因此,例如,如果在列表中选择了 Dolphin Browser,您将看到下图。我该怎么做?

enter image description here

最终解决方案将您的目标设置为 Gingerbread API 级别 9 并将您的最低设置为 API 级别 7

final int apiLevel = Build.VERSION.SDK_INT;
Intent intent = new Intent();
if (apiLevel >= 9) {
//TODO get working on gb
//Toast.makeText(SDMove.this, "Gingerbread Not Currently Supported", Toast.LENGTH_LONG).show();
startActivity(new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.parse("package:" + pli.pkg.packageName)));
} else {
final String appPkgName = (apiLevel == 8 ? "pkg" : "com.android.settings.ApplicationPkgName");
intent.setAction(Intent.ACTION_VIEW);
intent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails");
intent.putExtra(appPkgName, pli.pkg.packageName);
startActivity(intent);
}

最佳答案

试试这个:

startActivity(new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:your.package.here")));

并将“package:your.package.here”替换为您要查看的真实包...

关于java - Android 启动应用详情页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6238946/

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