На строке 558 (которую я отметил в kоде ) выдает ошибку. Помогите пожалйуста [требует правки]

313
26 апреля 2018, 11:47
 package messenger.hfad.com.hava;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.os.AsyncTask;
 import android.os.Bundle;
 import android.support.v4.view.ViewPager;
 import android.support.v7.app.AppCompatActivity;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.ImageView;
 import android.widget.TextView;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpStatus;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
 public class MainActivity extends AppCompatActivity {
TextView textView1;
TextView textView2;
TextView textView3;
TextView textView4;
TextView textView5;
TextView textView6;
TextView textView7;
TextView textView8;
TextView textView9;
TextView textView10;
TextView textView11;
TextView textView12;
TextView textView13;
TextView textView14;
TextView textView15;
TextView textViewVariant1;
TextView textViewVariant2;
TextView textViewVariant3;
TextView textViewVariant4;
TextView textViewVariant5;
TextView textViewVariant6;
TextView textViewVariant7;
TextView textViewVariant8;
TextView textViewVariant9;
TextView textViewVariant10;
TextView textViewVariant11;
TextView textViewVariant12;
TextView textViewVariant13;
TextView textViewVariant14;
TextView textViewVariant15;
TextView utext1;
TextView utext2;
TextView utext3;
TextView utext4;
TextView utext5;
TextView utext6;
TextView utext7;
TextView utext8;
TextView utext9;
TextView utext10;
TextView utext11;
TextView utext12;
TextView utext13;
TextView utext14;
TextView utext15;
ImageView imageView;
ImageView imageViewVariant;
ImageView iu;
Element image;
Element imageVariant;
Element u;
public String URL = "http://havainfo.az/full_proqnoz.html";
public String saatURL = "http://havainfo.az/";
public String imageURL = "https://pogoda.tourister.ru/azerbaijan/baku";
public String yandexURL = "https://yandex.ru/pogoda/baku/details";
String selector1 = "table:nth-child(7) > tbody > tr:nth-child(1) > th > span.weather_table_text_right";
String selector2 = "table:nth-child(7) > tbody > tr:nth-child(2) > th:nth-child(2) > div.full_proqnoz_big_left > div.full_proqnoz_big_bottom";
String selector3 = "table:nth-child(7) > tbody > tr:nth-child(2) > th.weather_table_text_mini > span:nth-child(1)";
String selector4 = "table:nth-child(7) > tbody > tr:nth-child(3) > td:nth-child(1) > div.full_proqnoz_icon_text";
String selector5 = "table:nth-child(7) > tbody > tr:nth-child(2) > th.weather_table_text_mini > span:nth-child(2)";
String selector6 = "table:nth-child(7) > tbody > tr:nth-child(3) > td:nth-child(2) > div.full_proqnoz_icon_text";
String selector7 = "div.city_head_full > span.city_left_time";
String selector8 = "table:nth-child(7) > tbody > tr:nth-child(1) > th > span:nth-child(2)";
String selector9 = "dd:nth-child(2) > table > tbody > tr:nth-child(2) > td.weather-table__body-cell.weather-table__body-cell_type_daypart.weather-table__body-cell_wrapper > div > div.weather-table__temp";
String selector10 = "table:nth-child(7) > tbody > tr:nth-child(1) > th > span:nth-child(1)";
String selector11 = "dd:nth-child(2) > table > tbody > tr:nth-child(4) > td.weather-table__body-cell.weather-table__body-cell_type_daypart.weather-table__body-cell_wrapper > div > div.weather-table__temp";
String selector12 = "table:nth-child(7) > tbody > tr:nth-child(2) > th.weather_table_text_mini > span:nth-child(3)";
String selector13 = "dd:nth-child(2) > table > tbody > tr:nth-child(2) > td.weather-table__body-cell.weather-table__body-cell_type_wind.weather-table__body-cell_wrapper > div > span > span";
String selector14 = "table:nth-child(7) > tbody > tr:nth-child(2) > th.weather_table_text_mini > span:nth-child(5)";
String selector15 = "dd:nth-child(2) > table > tbody > tr:nth-child(2) > td.weather-table__body-cell.weather-table__body-cell_type_air-pressure";
String selectorImageView = "div#weather_table div > div:nth-child(1) > div:nth-child(2) > img";
String selectorVariant1 = "table:nth-child(8) > tbody > tr:nth-child(1) > th > span.weather_table_text_right";
String selectorVariant2 = "table:nth-child(8) > tbody > tr:nth-child(2) > th:nth-child(2) > div.full_proqnoz_big_left > div.full_proqnoz_big_bottom";
String selectorVariant3 = "table:nth-child(8) > tbody > tr:nth-child(2) > th.weather_table_text_mini > span:nth-child(1)";
String selectorVariant4 = "table:nth-child(8) > tbody > tr:nth-child(3) > td:nth-child(1) > div.full_proqnoz_icon_text";
String selectorVariant5 = "table:nth-child(8) > tbody > tr:nth-child(2) > th.weather_table_text_mini > span:nth-child(2)";
String selectorVariant6 = "table:nth-child(8) > tbody > tr:nth-child(3) > td:nth-child(2) > div.full_proqnoz_icon_text";
String selectorVariant8 = "table:nth-child(8) > tbody > tr:nth-child(1) > th > span:nth-child(2)";
String selectorVariant9 = "dd:nth-child(5) > table > tbody > tr:nth-child(2) > td.weather-table__body-cell.weather-table__body-cell_type_daypart.weather-table__body-cell_wrapper > div > div.weather-table__temp";
String selectorVariant10 = "table:nth-child(8) > tbody > tr:nth-child(1) > th > span:nth-child(1)";
String selectorVariant11 = "dd:nth-child(5) > table > tbody > tr:nth-child(4) > td.weather-table__body-cell.weather-table__body-cell_type_daypart.weather-table__body-cell_wrapper > div > div.weather-table__temp";
String selectorVariant12 = "table:nth-child(8) > tbody > tr:nth-child(2) > th.weather_table_text_mini > span:nth-child(3)";
String selectorVariant13 = "dd:nth-child(5) > table > tbody > tr:nth-child(2) > td.weather-table__body-cell.weather-table__body-cell_type_wind.weather-table__body-cell_wrapper > div > span > span";
String selectorVariant14 = "table:nth-child(8) > tbody > tr:nth-child(2) > th.weather_table_text_mini > span:nth-child(5)";
String selectorVariant15 = "dd:nth-child(5) > table > tbody > tr:nth-child(2) > td.weather-table__body-cell.weather-table__body-cell_type_air-pressure";
String selectorVariantImageView = "div#weather_table div:nth-child(2) > div:nth-child(2) > img";
String uselector1 = "table:nth-child(9) > tbody > tr:nth-child(1) > th > span.weather_table_text_right";
String uselector2 = "table:nth-child(9) > tbody > tr:nth-child(2) > th:nth-child(2) > div.full_proqnoz_big_left > div.full_proqnoz_big_bottom";
String uselector3 = "table:nth-child(9) > tbody > tr:nth-child(2) > th.weather_table_text_mini > span:nth-child(1)";
String uselector4 = "table:nth-child(9) > tbody > tr:nth-child(3) > td:nth-child(1) > div.full_proqnoz_icon_text";
String uselector5 = "table:nth-child(9) > tbody > tr:nth-child(2) > th.weather_table_text_mini > span:nth-child(2)";
String uselector6 = "table:nth-child(9) > tbody > tr:nth-child(3) > td:nth-child(2) > div.full_proqnoz_icon_text";
String uselector8 = "table:nth-child(9) > tbody > tr:nth-child(1) > th > span:nth-child(2)";
String uselector9 = "dd:nth-child(7) > table > tbody > tr:nth-child(2) > td.weather-table__body-cell.weather-table__body-cell_type_daypart.weather-table__body-cell_wrapper > div > div.weather-table__temp";
String uselector10 = "table:nth-child(9) > tbody > tr:nth-child(1) > th > span:nth-child(1)";
String uselector11 = "dd:nth-child(7) > table > tbody > tr:nth-child(4) > td.weather-table__body-cell.weather-table__body-cell_type_daypart.weather-table__body-cell_wrapper > div > div.weather-table__temp";
String uselector12 = "table:nth-child(9) > tbody > tr:nth-child(2) > th.weather_table_text_mini > span:nth-child(3)";
String uselector13 = "dd:nth-child(7) > table > tbody > tr:nth-child(2) > td.weather-table__body-cell.weather-table__body-cell_type_wind.weather-table__body-cell_wrapper > div > span > span";
String uselector14 = "table:nth-child(9) > tbody > tr:nth-child(2) > th.weather_table_text_mini > span:nth-child(5)";
String uselector15 = "dd:nth-child(7) > table > tbody > tr:nth-child(2) > td.weather-table__body-cell.weather-table__body-cell_type_air-pressure";
String uselectorImage = "div#weather_table div:nth-child(3) > div:nth-child(2) > img";
String text1 = "";
String text2 = "";
String text3 = "";
String text4 = "";
String text5 = "";
String text6 = "";
String text7 = "";
String text8 = "";
String text9 = "";
String text10 = "";
String text11 = "";
String text12 = "";
String text13 = "";
String text14 = "";
String text15 = "";
String textVariant1 = "";
String textVariant2 = "";
String textVariant3 = "";
String textVariant4 = "";
String textVariant5 = "";
String textVariant6 = "";
String textVariant7 = "";
String textVariant8 = "";
String textVariant9 = "";
String textVariant10 = "";
String textVariant11 = "";
String textVariant12 = "";
String textVariant13 = "";
String textVariant14 = "";
String textVariant15 = "";
String u1 = "";
String u2 = "";
String u3 = "";
String u4 = "";
String u5 = "";
String u6 = "";
String u7 = "";
String u8 = "";
String u9 = "";
String u10 = "";
String u11 = "";
String u12 = "";
String u13 = "";
String u14 = "";
String u15 = "";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    LayoutInflater inflater = LayoutInflater.from(this);
    List<View> pages = new ArrayList<>();
    View page = inflater.inflate(R.layout.activity_main, null);
    new NetworkTask().execute();
    TextView textView1p = page.findViewById(R.id.idTextView1);
    textView1p.setText(text1);
    TextView textView2p = page.findViewById(R.id.idTextView2);
    textView2p.setText(text2);
    TextView textView3p = page.findViewById(R.id.idTextView3);
    textView3p.setText(text3);
    TextView textView4p = page.findViewById(R.id.idTextView4);
    textView4p.setText(text4);
    TextView textView5p = page.findViewById(R.id.idTextView5);
    textView5p.setText(text5);
    TextView textView6p = page.findViewById(R.id.idTextView6);
    textView6p.setText(text6);
    TextView textView7p = page.findViewById(R.id.idTextView7);
    textView7p.setText(text7);
    TextView textView8p = page.findViewById(R.id.idTextView8);
    textView8p.setText(text8);
    TextView textView9p = page.findViewById(R.id.idTextView9);
    textView9p.setText(text9);
    TextView textView10p = page.findViewById(R.id.idTextView10);
    textView10p.setText(text10);
    TextView textView11p = page.findViewById(R.id.idTextView11);
    textView11p.setText(text11);
    TextView textView12p = page.findViewById(R.id.idTextView12);
    textView12p.setText(text12);
    TextView textView13p = page.findViewById(R.id.idTextView13);
    textView13p.setText(text13);
    TextView textView14p = page.findViewById(R.id.idTextView14);
    textView14p.setText(text14);
    TextView textView15p = page.findViewById(R.id.idTextView15);
    textView15p.setText(text15);
    pages.add(page);

    page = inflater.inflate(R.layout.variant, null);
    textView1p = page.findViewById(R.id.idVTextView1);
    textView1p.setText(textVariant1);
    textView2p = page.findViewById(R.id.idVTextView2);
    textView2p.setText(textVariant2);
    textView3p = page.findViewById(R.id.idVTextView3);
    textView3p.setText(textVariant3);
    textView4p = page.findViewById(R.id.idVTextView4);
    textView4p.setText(textVariant4);
    textView5p = page.findViewById(R.id.idVTextView5);
    textView5p.setText(textVariant5);
    textView6p = page.findViewById(R.id.idVTextView6);
    textView6p.setText(textVariant6);
    textView7p = page.findViewById(R.id.idVTextView7);
    textView7p.setText(textVariant7);
    textView8p = page.findViewById(R.id.idVTextView8);
    textView8p.setText(textVariant8);
    textView9p = page.findViewById(R.id.idVTextView9);
    textView9p.setText(textVariant9);
    textView10p = page.findViewById(R.id.idVTextView10);
    textView10p.setText(textVariant10);
    textView11p = page.findViewById(R.id.idVTextView11);
    textView11p.setText(textVariant11);
    textView12p = page.findViewById(R.id.idVTextView12);
    textView12p.setText(textVariant12);
    textView13p = page.findViewById(R.id.idVTextView13);
    textView13p.setText(textVariant13);
    textView14p = page.findViewById(R.id.idVTextView14);
    textView14p.setText(textVariant14);
    textView15p = page.findViewById(R.id.idVTextView15);
    textView15p.setText(textVariant15);
    pages.add(page);

    page = inflater.inflate(R.layout.ucuncu_gun, null);
    textView1p = page.findViewById(R.id.idu1);
    textView1p.setText(u1);
    textView2p = page.findViewById(R.id.idu2);
    textView2p.setText(u2);
    textView3p = page.findViewById(R.id.idu3);
    textView3p.setText(u3);
    textView4p = page.findViewById(R.id.idu4);
    textView4p.setText(u4);
    textView5p = page.findViewById(R.id.idu5);
    textView5p.setText(u5);
    textView6p = page.findViewById(R.id.idu6);
    textView6p.setText(u6);
    textView7p = page.findViewById(R.id.idu7);
    textView7p.setText(u7);
    textView8p = page.findViewById(R.id.idu8);
    textView8p.setText(u8);
    textView9p = page.findViewById(R.id.idu9);
    textView9p.setText(u9);
    textView10p = page.findViewById(R.id.idu10);
    textView10p.setText(u10);
    textView11p = page.findViewById(R.id.idu11);
    textView11p.setText(u11);
    textView12p = page.findViewById(R.id.idu12);
    textView12p.setText(u12);
    textView13p = page.findViewById(R.id.idu13);
    textView13p.setText(u13);
    textView14p = page.findViewById(R.id.idu14);
    textView14p.setText(u14);
    textView15p = page.findViewById(R.id.idu15);
    textView15p.setText(u15);
    pages.add(page);

    SamplePagerAdapter pagerAdapter = new SamplePagerAdapter(pages);
    ViewPager viewPager = new ViewPager(this);
    viewPager.setAdapter(pagerAdapter);
    viewPager.setCurrentItem(0);
    setContentView(viewPager);
}


private class NetworkTask extends AsyncTask<Void, Void, Void> {

    @Override
    protected Void doInBackground(Void... voids) {
        Document doc = null;
        try {
            doc = Jsoup.connect(yandexURL).get();
            text9 = doc.select(selector9).first().text();
            text11 = doc.select(selector11).first().text();
            text13 = doc.select(selector13).first().text();
            text15 = doc.select(selector15).first().text();
            textVariant9 = doc.select(selectorVariant9).first().text();
            textVariant11 = doc.select(selectorVariant11).first().text();
            textVariant13 = doc.select(selectorVariant13).first().text();
            textVariant15 = doc.select(selectorVariant15).first().text();
            u9 = doc.select(uselector9).first().text();
            u11 = doc.select(uselector11).first().text();
            u13 = doc.select(uselector13).first().text();
            u15 = doc.select(uselector15).first().text();
            doc = Jsoup.connect(imageURL).get();
            imageVariant = doc.select(selectorVariantImageView).first();
            String urlV = imageVariant.absUrl("src");
            new ImageDownloaderVariant().execute(urlV);
            image = doc.select(selectorImageView).first();
            String url = image.absUrl("src");
            new ImageDownloader().execute(url);
            u = doc.select(uselectorImage).first();
            String ur = u.absUrl("src");
            new ImageDownloaderu().execute(ur);
            doc = Jsoup.connect(saatURL).get();
            text7 = doc.select(selector7).first().text();
            textVariant7 = doc.select(selector7).first().text();
            u7 = doc.select(selector7).first().text();
            doc = Jsoup.connect(URL).get();
            text1 = doc.select(selector1).first().text();
            text2 = doc.select(selector2).first().text();
            text3 = doc.select(selector3).first().text();
            text4 = doc.select(selector4).first().text();
            text5 = doc.select(selector5).first().text();
            text6 = doc.select(selector6).first().text();
            text8 = doc.select(selector8).first().text();
            text10 = doc.select(selector10).first().text();
            text12 = doc.select(selector12).first().text();
            text14 = doc.select(selector14).first().text();
            textVariant1 = doc.select(selectorVariant1).first().text();
            textVariant2 = doc.select(selectorVariant2).first().text();
            textVariant3 = doc.select(selectorVariant3).first().text();
            textVariant4 = doc.select(selectorVariant4).first().text();
            textVariant5 = doc.select(selectorVariant5).first().text();
            textVariant6 = doc.select(selectorVariant6).first().text();
            textVariant8 = doc.select(selectorVariant8).first().text();
            textVariant10 = doc.select(selectorVariant10).first().text();
            textVariant12 = doc.select(selectorVariant12).first().text();
            textVariant14 = doc.select(selectorVariant14).first().text();
            u1 = doc.select(uselector1).first().text();
            u2 = doc.select(uselector2).first().text();
            u3 = doc.select(uselector3).first().text();
            u4 = doc.select(uselector4).first().text();
            u5 = doc.select(uselector5).first().text();
            u6 = doc.select(uselector6).first().text();
            u8 = doc.select(uselector8).first().text();
            u10 = doc.select(uselector10).first().text();
            u12 = doc.select(uselector12).first().text();
            u14 = doc.select(uselector14).first().text();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public void onPostExecute(Void aVoid) {
        textView1 = findViewById(R.id.idTextView1);
        textView2 = findViewById(R.id.idTextView2);
        textView3 = findViewById(R.id.idTextView3);
        textView4 = findViewById(R.id.idTextView4);
        textView5 = findViewById(R.id.idTextView5);
        textView6 = findViewById(R.id.idTextView6);
        textView7 = findViewById(R.id.idTextView7);
        textView8 = findViewById(R.id.idTextView8);
        textView9 = findViewById(R.id.idTextView9);
        textView10 = findViewById(R.id.idTextView10);
        textView11 = findViewById(R.id.idTextView11);
        textView12 = findViewById(R.id.idTextView12);
        textView13 = findViewById(R.id.idTextView13);
        textView14 = findViewById(R.id.idTextView14);
        textView15 = findViewById(R.id.idTextView15);
        textView1.setText(text1);
        textView2.setText(text2);
        textView3.setText(text3);
        textView4.setText(text4);
        textView5.setText(text5);
        textView6.setText(text6);
        textView7.setText(text7);
        textView8.setText(text8);
        textView9.setText(text9);
        textView10.setText(text10);
        textView11.setText(text11);
        textView12.setText(text12);
        textView13.setText(text13);
        textView14.setText(text14);
        textView15.setText(text15);
        textViewVariant1 = findViewById(R.id.idVTextView1);
        textViewVariant2 = findViewById(R.id.idVTextView2);
        textViewVariant3 = findViewById(R.id.idVTextView3);
        textViewVariant4 = findViewById(R.id.idVTextView4);
        textViewVariant5 = findViewById(R.id.idVTextView5);
        textViewVariant6 = findViewById(R.id.idVTextView6);
        textViewVariant7 = findViewById(R.id.idVTextView7);
        textViewVariant8 = findViewById(R.id.idVTextView8);
        textViewVariant9 = findViewById(R.id.idVTextView9);
        textViewVariant10 = findViewById(R.id.idVTextView10);
        textViewVariant11 = findViewById(R.id.idVTextView11);
        textViewVariant12 = findViewById(R.id.idVTextView12);
        textViewVariant13 = findViewById(R.id.idVTextView13);
        textViewVariant14 = findViewById(R.id.idVTextView14);
        textViewVariant15 = findViewById(R.id.idVTextView15);
        textViewVariant1.setText(textVariant1);
        textViewVariant2.setText(textVariant2);
        textViewVariant3.setText(textVariant3);
        textViewVariant4.setText(textVariant4);
        textViewVariant5.setText(textVariant5);
        textViewVariant6.setText(textVariant6);
        textViewVariant7.setText(textVariant7);
        textViewVariant8.setText(textVariant8);
        textViewVariant9.setText(textVariant9);
        textViewVariant10.setText(textVariant10);
        textViewVariant11.setText(textVariant11);
        textViewVariant12.setText(textVariant12);
        textViewVariant13.setText(textVariant13);
        textViewVariant14.setText(textVariant14);
        textViewVariant15.setText(textVariant15);
        utext1 = findViewById(R.id.idu1);
        utext2 = findViewById(R.id.idu2);
        utext3 = findViewById(R.id.idu3);
        utext4 = findViewById(R.id.idu4);
        utext5 = findViewById(R.id.idu5);
        utext6 = findViewById(R.id.idu6);
        utext7 = findViewById(R.id.idu7);
        utext8 = findViewById(R.id.idu8);
        utext9 = findViewById(R.id.idu9);
        utext10 = findViewById(R.id.idu10);
        utext11 = findViewById(R.id.idu11);
        utext12 = findViewById(R.id.idu12);
        utext13 = findViewById(R.id.idu13);
        utext14 = findViewById(R.id.idu14);
        utext15 = findViewById(R.id.idu15);
        utext1.setText(u1);
      //(Строка 558)
     // (ошибка)
    //  ("Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference")

    }
}

private class ImageDownloader extends AsyncTask<String, Void, Bitmap> {
    @Override
    protected Bitmap doInBackground(String... params) {
        return downloadBitmap(params[0]);
    }
    @Override
    protected void onPreExecute() {
    }
    @Override
    protected void onPostExecute(Bitmap result) {
        imageView = findViewById(R.id.idImageView);
        imageView.setImageBitmap(result);
    }

    private Bitmap downloadBitmap(String url) {
        final DefaultHttpClient client = new DefaultHttpClient();
        final HttpGet getRequest = new HttpGet(url);
        try {
            HttpResponse response = client.execute(getRequest);
            final int statusCode = response.getStatusLine().getStatusCode();
            if (statusCode != HttpStatus.SC_OK) {
                return null;
            }
            final HttpEntity entity = response.getEntity();
            if (entity != null) {
                InputStream inputStream = null;
                try {
                    inputStream = entity.getContent();
                    final Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
                    return bitmap;
                }
                finally {
                    if (inputStream != null) {
                        inputStream.close();
                    }
                    entity.consumeContent();
                }
            }
        }
        catch (Exception e) {
            getRequest.abort();
        }
        return null;
    }
}
private class ImageDownloaderVariant extends AsyncTask<String, Void, Bitmap> {
    @Override
    protected Bitmap doInBackground(String... params) {
        return downloadBitmap(params[0]);
    }
    @Override
    protected void onPreExecute() {
    }
    @Override
    protected void onPostExecute(Bitmap result) {
        imageViewVariant = findViewById(R.id.idVimageView);
        imageViewVariant.setImageBitmap(result);
    }

    private Bitmap downloadBitmap(String url) {
        final DefaultHttpClient client = new DefaultHttpClient();
        final HttpGet getRequest = new HttpGet(url);
        try {
            HttpResponse response = client.execute(getRequest);
            final int statusCode = response.getStatusLine().getStatusCode();
            if (statusCode != HttpStatus.SC_OK) {
                return null;
            }
            final HttpEntity entity = response.getEntity();
            if (entity != null) {
                InputStream inputStream = null;
                try {
                    inputStream = entity.getContent();
                    final Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
                    return bitmap;
                }
                finally {
                    if (inputStream != null) {
                        inputStream.close();
                    }
                    entity.consumeContent();
                }
            }
        }
        catch (Exception e) {
            getRequest.abort();
        }
        return null;
    }
}


private class ImageDownloaderu extends AsyncTask<String, Void, Bitmap> {
    @Override
    protected Bitmap doInBackground(String... params) {
        return downloadBitmap(params[0]);
    }
    @Override
    protected void onPreExecute() {
    }
    @Override
    protected void onPostExecute(Bitmap result) {
        iu = findViewById(R.id.idui);
        iu.setImageBitmap(result);
    }

    private Bitmap downloadBitmap(String url) {
        final DefaultHttpClient client = new DefaultHttpClient();
        final HttpGet getRequest = new HttpGet(url);
        try {
            HttpResponse response = client.execute(getRequest);
            final int statusCode = response.getStatusLine().getStatusCode();
            if (statusCode != HttpStatus.SC_OK) {
                return null;
            }
            final HttpEntity entity = response.getEntity();
            if (entity != null) {
                InputStream inputStream = null;
                try {
                    inputStream = entity.getContent();
                    final Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
                    return bitmap;
                }
                finally {
                    if (inputStream != null) {
                        inputStream.close();
                    }
                    entity.consumeContent();
                }
            }
        }
        catch (Exception e) {
            getRequest.abort();
        }
        return null;
       }
    }
}
READ ALSO
Выпадающий список с данными из бд

Выпадающий список с данными из бд

Создаю CRUD приложениеЕсть две таблицы type и category:

357
Что использовать место deprecated createJsonGenerator в Jackson API?

Что использовать место deprecated createJsonGenerator в Jackson API?

Надо найти альтернативу но гугл не помогаетЕсть идеи?

180
BroadcastReceiver не ловит кастомные action

BroadcastReceiver не ловит кастомные action

Проблема заключается в том что BroadcastReceiver никаким образом не реагирует на кастомные action которые я отправляю, а с системными он работает отличноКто...

204
Вывод HashMap в окно JFrame [требует правки]

Вывод HashMap в окно JFrame [требует правки]

Появилось небольшое курсовое заданиеЯ передаю данные с телефона на компьютер по Wi-Fi через сокеты

180