How to store pdf file from asset folder to memory card in android?

Use AssetManager to get the pdf: AssetManager assetManager = getAssets(); InputStream inputStream = assetManager. Open("your_pdf. Pdf") and then you can write that to the card: File sdCard = Environment.

GetExternalStorageDirectory(); File dir = new File (sdcard.getAbsolutePath() + "/where/you/want/it"); dir.mkdirs(); File file = new File(dir, "your_pdf. Pdf"); FileOutputStream f = new FileOutputStream(file) and display it Uri path = Uri. FromFile(file); Intent intent = new Intent(Intent.

ACTION_VIEW); intent. SetFlags(Intent. FLAG_ACTIVITY_CLEAR_TOP); intent.

SetDataAndType(path, "application/pdf"); startActivity(intent).

Use AssetManager to get the pdf: AssetManager assetManager = getAssets(); InputStream inputStream = assetManager. Open("your_pdf. Pdf"); and then you can write that to the card: File sdCard = Environment.

GetExternalStorageDirectory(); File dir = new File (sdcard.getAbsolutePath() + "/where/you/want/it"); dir.mkdirs(); File file = new File(dir, "your_pdf. Pdf"); FileOutputStream f = new FileOutputStream(file); and display it Uri path = Uri. FromFile(file); Intent intent = new Intent(Intent.

ACTION_VIEW); intent. SetFlags(Intent. FLAG_ACTIVITY_CLEAR_TOP); intent.

SetDataAndType(path, "application/pdf"); startActivity(intent).

Benwilliams its not working its giving filenotfoundexception permisson denied. – user386430 Apr 20 at 21:38 You'll need to write. Try calling String files = assetManager.list() and walking through it to see if your PDF shows up.

– Ben Williams Apr 20 at 21:59 @Ben Williams that error is fixed still not displaying . I think problem in display code can you tell what I have to do – user386430 Apr 21 at 14:19 In what way is it not displaying? Can you pull the written file off the SDCard directly and check it has been written correctly?

How large is your PDF? – Ben Williams Apr 21 at 15:04 @ben williams yes I can pull from sdcard the pdf size is very small only – user386430 Apr 22 at 10:09.

InputStream inputStream = assetManager. File sdCard = Environment. File file = new File(dir, "your_pdf.

Uri path = Uri. Intent intent = new Intent(Intent.

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.

Related Questions