You would be able to show it from raw or assets if your application actually implemented a PDF reader. Since you want it to be displayed in a separate application (such as Adobe Reader), I suggest doing the following.
You would be able to show it from raw/ or assets/ if your application actually implemented a PDF reader. Since you want it to be displayed in a separate application (such as Adobe Reader), I suggest doing the following: Store the PDF file in the assets/ directory. When the user wants to view it, copy it somewhere public.
Look into openFileOutput or getExternalFilesDir. Launch the Intent just like you are doing now, except use getAbsolutePath() on the newly created file for the intent's data. Be aware that a user might not have a PDF reading application.In this case, it is useful to catch the ActivityNotFoundException and show an appropriate message.
1 You can use the PackageManager's queryIntentActivities method to check if any activity can respond to a given Intent. See here for an example – David Caunt Jun 27 at 10:31 @David I knew I was forgetting something! Thanks for adding that.
– Felix Jun 27 at 10:48 :) I have a feeling your answer is the best solution unless external applications can access package resources. – David Caunt Jun 27 at 11:01.
I've used the following format to open raw resources from within my own application. I haven't tested whether another application can open your raw resource. Uri path = Uri.
Parse("android. Resource://" + getPackageName() + "/" R.raw. MyPdfName).
Hmm, I have adobe reader installed on my device, but I get a ActivitynotFoundException. Any ideas? – Ikky Jun 27 at 10:47 Either the URI or the mime type (or both) can't be matched, unfortunately I don't know how the Reader application matches.
You might have to try with and without specifying the mime type, and try opening something from the SD card as it may be that it won't open from your raw resources at all. – David Caunt Jun 27 at 10:56.
You pdf intent seems good but you should try this to get the Uri of file in the raw folder : Uri path = Uri. Parse("android. Resource:///raw/"); (Source) Regards, Stéphane.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.