package com.teigrevena.optikos.thermokrasia; import android.os.StrictMode; import android.provider.DocumentsContract; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import java.io.IOException; public class MainActivity extends AppCompatActivity { TextView mTextView ; TextView mTextView2 ; String therm; String therm2; String url; Document doc; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); mTextView = (TextView) findViewById(R.id.textView4); mTextView2 = (TextView) findViewById(R.id.textView5); url = "http://penteli.meteo.gr/stations/grevena"; doc = null; try { doc = Jsoup.connect(url).get(); } catch (IOException e) { //... e.printStackTrace(); } Element table = doc.select("table").get(0); //select the first table. Elements rows = table.select("tr"); ///////////////////////////////////////// Element row = rows.get(5); Elements cols = row.select("td"); therm = cols.get(1).text() ; mTextView.setText(therm); ////////////////////////////// Element row2 = rows.get(6); Elements cols2 = row2.select("td"); therm2 = cols2.get(1).text() ; mTextView2.setText(therm2); /////////////////////////// } }