title: Jsoup parsing with Android
body: <p>I'm trying to parse html with <code>Jsoup</code> lib. However, I did not get what I want.
  I want to bring to the screen of a mobile device the entire text of the tag <code>&lt;pre&gt;</code></p>
  
  <p>Please tell me, how do I get the text from web? How do I need to fix?</p>
  
  <p>Web site: <a href="http://devanswers.ru/text.php" rel="nofollow">http://devanswers.ru/text.php</a></p>
  
  <pre><code>package com.example.devanswers;
  import java.io.IOException;
  import org.jsoup.Jsoup;
  import org.jsoup.nodes.Document;
  import org.jsoup.nodes.Element;
  import org.jsoup.select.Elements;
  import android.app.Activity;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.ImageView;
  import android.widget.TextView;
  
  public class MainActivity extends Activity {
  
      TextView DevMainText;
      ImageView DevMainImage;
      MyTask DevMain;
  
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          DevMainText = (TextView) findViewById(R.id.DevMainText);
          DevMainImage = (ImageView) findViewById(R.id.DevMainImage);
  
          OnClickListener onClick = new OnClickListener() {
              public void onClick(View v) {
  
                  DevMain = new MyTask();
                  DevMain.execute();
              }
          };
  
          DevMainImage.setOnClickListener(onClick);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.main, menu);
          return true;
      }
  
      class MyTask extends AsyncTask&lt;Void, Void, Void&gt; {
  
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
              DevMainImage.setEnabled(false);
          }
  
          @Override
          protected Void doInBackground(Void... params) {
              Document doc;
              try {
                  doc = Jsoup.connect("http://devanswers.ru/text.php").get();
                  Elements links = doc.getElementsByTag("pre");
                  for (Element link : links) {
                      DevMainText.setText((link.text()));
                  }
              } catch (IOException e) {
                  // TODO Auto-generated catch block
                  DevMainText.setText("Error");
              }
  
              return null;
          }
  
          @Override
          protected void onPostExecute(Void result) {
              super.onPostExecute(result);
              DevMainImage.setEnabled(true);
          }
      }
  
  }
  </code></pre>