public static ArrayList<String> getTextFromWeb(String urlString)
{
ArrayList<String> contents=new ArrayList<String>();
try
{
URL feedUrl = new URL(urlString);
HttpURLConnection conn=(HttpURLConnection) feedUrl.openConnection();
//conn.setConnectTimeout(60000); // timing out in a minute
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
//t=(TextView)findViewById(R.id.TextView1);
String str;
while ((str = in.readLine()) != null) {
contents.add(str);
}
in.close();
return contents; // return whatever you need
}
catch (Exception e)
{
e.printStackTrace();
}
return null;
}
No comments:
Post a Comment