Previously, I used the the XML file from the assets folder. The app can read it very well. The next step I want put this XML on the web server. But at this stage, the app cannot recognize any data. It confused me couple of days.
AssetManager asset = getAssets();
InputStream input = asset.open("student.xml");
List<Student> list = ParserByPULL.getStudents(input);
Everything works fine if the file in assets folder. Then I tried to get it from an URL.
String path = "http://fthgyj.tup632.cnaaa11.com/student.xml";
URL url = new URL(path);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(5000);
conn.setRequestMethod("GET");
InputStream input = url.openConnection().getInputStream();
List<Student> list = ParserByPULL.getStudents(input);
I have added the permission of connecting the INTERNET at manifest file. Does anyone has an idea about this?