-1

I'm trying to find a simple way to get a TXT file from a web server to be used in an android application development. I would want to access the file in the same way that I can access a locally stored file using FileInputStream and FileOutputStream.

Is there a way for me to download the file and save it locally for use with those?

TheBritishBloke
  • 169
  • 1
  • 2
  • 8
  • Check this [tutorial](http://www.helloandroid.com/tutorials/how-download-fileimage-url-your-device), but dont use the PATH variable, use this : `yourContext.getFilesDir()`. Context is just your `activityname.this` – Toumash Dec 01 '14 at 21:33
  • But YOU MUST use Thread or AsyncTask, otherwise app will hang. Check basic downloading from stream, and then see AndroidNFC answer below. You can skip `publicProgressPark` if you wont understand – Toumash Dec 01 '14 at 21:41
  • I've not managed to fix this yet, going to crack on with other things and then try it later this week. I'll update it if I manage to figure it out. – TheBritishBloke Dec 02 '14 at 17:26

1 Answers1

0

You question is too general. Here are some hints on how the Downloading from NET works in Android: How to Download a File with Android

Take a closer look to DownloadTask which extends AsyncTask (following is essential to understand how to download with Android)

Community
  • 1
  • 1
David Kasabji
  • 1,049
  • 3
  • 15
  • 32
  • I dont recommend reading this question in the link, it is too hard to understand, too much data : ) turorial in my comment is much simplier. trust me, i'm engene.. :P – Toumash Dec 01 '14 at 21:35
  • @Toumash it's true that not everything there is what the user is asking, but the DownloadTask is essential knowledge in downloading with Android. Will edit my answer to be more specific. – David Kasabji Dec 01 '14 at 21:37
  • Yes, you are right, he will do nothing without AsyncTask – Toumash Dec 01 '14 at 21:39