我如何调用一个意图来启动 Android 操作系统中的原生下载应用程序。我为此搜索了很多,这与我得到的一样接近:
Intent i = new Intent();
ComponentName comp = new ComponentName("com.sec.android.providers.downloads","com.sec.android.providers.downloads.DownloadActivity");
i.setComponent(comp);
i.setAction("android.intent.action.VIEW");
self.startActivity(i);
我也试过:
Intent i = new Intent();
PackageManager manager = getActivity().getPackageManager();
i = manager.getLaunchIntentForPackage("com.sec.android.providers.downloads");
i.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(i);
但它给了我一个JavaNullPointerException: i.addCategory(Intent.CATEGORY_LAUNCHER);