Is there a way to extract the text from a website (That only has text and can be updated by the webserver) and put it in a text view or string variable so that it will show the text in my android app.
Also, there are different languages based on what region your phone is in (English being the default).
This is what I’ve been using so far
public String getText(String uri) {
HttpClient client1 = new DefaultHttpClient();
HttpGet request = new HttpGet(uri);
ResponseHandler<String> responseHandler = new BasicResponseHandler();
try {
String response_str = client1.execute(request, responseHandler);
return response_str;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return "";
}
Unfortunately I haven’t figured out a way to get rid of the html code or how to change the website being passed in depending on the region. Thanks
this is a very simple function that I use to make my code look cleaner.