private class DownloadTask extends AsyncTask { @Override protected String doInBackground(URL... params) { URL yahoo = null; try { yahoo = new URL("http://www.spaces.ru/"); BufferedReader in = new BufferedReader( new InputStreamReader( yahoo.openStream())); String inputLine = null; Context context = getApplicationContext(); CharSequence text = "Hello toast!"; int duration = Toast.LENGTH_SHORT; String result = ""; while ((inputLine = in.readLine()) != null) { result += inputLine; } in.close(); return result; } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (NetworkOnMainThreadException e ) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(String result) { // Дебаг. Уровень: бог. TextView textView = (TextView) findViewById(R.id.textView22); textView.setText(result); } }