9

I am attempting to make an application that will primarily open and read a predetermined set of documents that I have. The original idea was for all the documents (about 40 equaling MB) to be copied into the user's internal memory (/data/data/(appname)/files) on first run or install. I realize that this may be a bad idea with some phones having limited space in the internal memory. I now am thinking of changing my app idea to download a file from a stored location on the internet and have it saved to the internal memory. This way the user can view only the needed documents, severely shaving down the size of the memory needed. I have seen some code snippets of how to download files, for this instance I want to use a PDFs, but I cannot find a way to save them to the internal memory (/data/data/(app)/files). I have seen many snippets dealing with databases but I need to save PDFs and doc files.

Any help on how to: 1. download a doc/PDFs file from the internet, 2. immediately save the file to internal memory, 3. launch the doc/PDFs from the internal memory using a 3rd party program (example being adobe reader).

I appreciate the help!

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
user1363871
  • 580
  • 3
  • 11
  • 29
  • What exactly do you mean "from the internet"? Where are those files stored? Are they publicly available over http (web)? Do you need certain credentials to access them? The Internet is a pretty big place. – smichak Apr 30 '12 at 05:36
  • And why do you insist on internal memory? Why can't you save those files to the external storage and use them from there? If you still want to use internal storage follow the guidelines here: https://developer.android.com/guide/topics/data/data-storage.html#filesInternal – smichak Apr 30 '12 at 05:41
  • Yes, publicly available files that I would upload so the app could just download them and place them in the stored location. I preffered the internal memory because I wouldn't want to clutter up the SDcard and most phones today don't run too low on internal memory - in my experience. – user1363871 Apr 30 '12 at 05:52
  • OK, it's just that I had some trouble accessing files on internal memory sometimes. And it might even be a phone and Android version dependent issue. – smichak Apr 30 '12 at 05:57
  • 1. download a doc/PDFs file from the internet, 2. immediately save the file to internal memory, For that you can try this example : [Example1](http://www.java-samples.com/showtutorial.php?tutorialid=1521) and [Example2](http://www.hassanpur.com/blog/2011/04/android-development-downloading-a-file-from-the-web/) – MKJParekh Apr 30 '12 at 05:42
  • 3. launch the doc/PDFs from the internal memory using a 3rd party program (example being adobe reader). For that you can use this Answers : [Answer1](https://stackoverflow.com/questions/2883355/how-to-render-pdf-in-android) and [Answer2](https://stackoverflow.com/questions/2923265/android-how-do-i-open-another-app-from-my-app) – MKJParekh Apr 30 '12 at 05:42

0 Answers0