I have to save text data of a website to the memory card. Afterwards, I'd like to use regular expressions to fetch a phone number.
I use this code to fetch the website:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.save);
TextView saveText = (TextView) findViewById(R.id.save_text);
String t = "";
String urltext = "http://vnexpress.net/";
try {
t = get_source_html(urltext);
} catch (Exception e) {
e.toString();
}
saveText.setText(t);
}
public static String get_source_html(String urltext) throws IOException {
URL url = new URL(urltext);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
String s = "";
while ((inputLine = in.readLine()) != null) {
s = s + inputLine;
}
s = s + "";
in.close();
return s;
}
However I can't fetch the phone number from text data. Could you help me please?