I am trying to view a local pdf in an external pdf viewer using this code:
Uri path = Uri.parse("android.resource://<package-name>/raw/Terms.pdf>");
try
{
Intent intentUrl = new Intent(Intent.ACTION_VIEW);
intentUrl.setDataAndType(path, "application/pdf");
intentUrl.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
getActivity().startActivity(intentUrl);
}
catch (ActivityNotFoundException e)
{
Toast.makeText(getActivity(), "No PDF Viewer Installed", Toast.LENGTH_LONG).show();
}
Even though I have Adobe PDF installed, it throws an ActivityNotFoundExcecption.
Why is that?