如何调用意图,启动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);
答案 0 :(得分:0)
Intent i = new Intent();
i.setAction(Intent.ACTION_VIEW);
Uri uri= Uri.fromFile(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS));
i.setData(uri);
startActivity(i);