Get information from HTML by identifying tags

All- I have never done this sort of thing before and am very confused. I have spent hours on Google looking for some example code or any hints but whenever I try to work with the available code I always get errors and end up more confused than when I started. So enough self pity and excuses. Lets get to the question: I have an app the "screen scraps" a website, right now Google. I have got it so I can display the html in a text view: My problem now is getting the information from this. All I want is the information in the title tag ("Google"). I have read about HTML parsing but was very confused when I read the information on TagSoup or others like that. Do I need those to do it or is there just some Java code I can write to pull out the title tag and make it into a string and than display it. If I do need an HTML parser, can someone give me some example code. I could not find any on their website. Here is the code I have so far:

public class MainActivity extends Activity {
String page;
String display;
Document doc;
public void onCreate(Bundle savedInstanceState) {
    new AddStringTask().execute();      
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(, menu);
    return true;
class AddStringTask extends AsyncTask<Void, String, Void> {    
    protected Void doInBackground(Void... unused) {
        DefaultHttpClient httpClient = new DefaultHttpClient();
        HttpGet httpGet = new HttpGet("");
        ResponseHandler<String> resHandler = new BasicResponseHandler();
        try {
            page = httpClient.execute(httpGet, resHandler);             
        } catch (ClientProtocolException e) {
            // TODO Auto-generated catch block
        } catch (IOException e) {
            // TODO Auto-generated catch block
        return null;

    protected void onProgressUpdate(String... item) {           
    protected void onPostExecute(Void unused) {  
        TextView google = (TextView) findViewById(;         

Any sample code would be great because I need to see some examples. Thanks a lot for your time.


jsoup: Java HTML Parser should do the trick:

Document doc = Jsoup.connect("").get();
String docTitle = doc.title();

Then pass docTitle to google.setText()

You can find more examples here.

Need Your Help

Best way to save data on the iPhone

iphone objective-c

I am writing an iPhone application, and need to save the state of my application (5K or so).

all.js root is null

javascript facebook

When loading my app all.js is throwing the following in IE8 at line 6:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.