-2

I have a small server that contains the text file which can be that is similar to:

http://127.0.0.1:59777/smb/192.168.0.250/Files/Interstellar.mp4
http://127.0.0.1:59777/smb/192.168.0.250/Files/уаау.mp4
http://127.0.0.1:59777/smb/192.168.0.250/Files/possible.mp4

and in my program have listView which to build a list of uses which should be built from a list in the file , and so I have 2 questions . 1) Is it possible to access the file via URL? If so then the question number 2 . 2) as soon as possible via the URL to read data from a file into an array of String []

        private static String[] dataObjects = new String[]{ "Text #1",
        "Text #2",
        "Text #3","Text #4","Text #5" };

passer on ?

2 Answers2

0

In short :

  • Load your url in a webview
  • Add two clients to your webview, like there
  • split your html with html.split("\n");
Community
  • 1
  • 1
Stéphane GROSSMANN
  • 369
  • 2
  • 5
  • 14
0
try {
    URL url = new URL("www.yoursite.com/file.txt");

    // Read all the text returned by the server
    BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
    String str = in.readLine();
    in.close();
} catch (MalformedURLException e) {
    in.close();
} catch (IOException e) {
    in.close();
}

and see this link in order to put it in a list:
http://sampleprogramz.com/android/listviewwebservice.php

Pang
  • 9,564
  • 146
  • 81
  • 122
Albert
  • 324
  • 1
  • 4
  • 20