Асинхронная загрузка веб страницы в Android studio

Автор: | 13.02.2017
private class DownloadWebPageTask extends AsyncTask<String, Void, String> {
    @Override
    protected String doInBackground(String... params) {
        URL url = null;

        String response = "";
        String requestURL="https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22karagandy%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys";
        try {
            url = new URL(requestURL);

            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setReadTimeout(15000);
            conn.setConnectTimeout(15000);
            conn.setRequestMethod("GET");


            int responseCode=conn.getResponseCode();

            if (responseCode == HttpsURLConnection.HTTP_OK) {
                String line;
                BufferedReader br=new BufferedReader(new InputStreamReader(conn.getInputStream()));
                while ((line=br.readLine()) != null) {
                    response+=line;
                }
            }
            else {
                response="";

            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        return response;
    }


    @Override
    protected void onPostExecute(String result) {
        //отобразаем полученные данные с сервера
        try {
            textView10.setText(result);
        }
        catch(Exception e)
        {}
    }
}

public void readWebpage() {
    MainActivity.DownloadWebPageTask task = new MainActivity.DownloadWebPageTask();
    task.execute(new String[]{});
}