When calling Picasso.with(MainActivity.this).load(captchaImg).into(img); throw an exception saying java.lang.IllegalArgumentException: Target must not be null. I understand that he does not have enough ImageView , but I gave it to him, announced it, and he still sees it as null , why?
Transferred to the main main_layout , is displayed, and in AlertDialog(captcha_layout) when I try to pass a link to img ... it sees as null. Can somehow not truly work with AlertDialog ?
public class MainActivity extends AppCompatActivity { private String url; private String captchaImg; private ImageView img; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); img = (ImageView) findViewById(R.id.imageView) btn_start.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new ShowDialogAsyncTask().execute(); } }); } private class ShowDialogAsyncTask extends AsyncTask<Void, Integer, Void> { @Override protected void onPostExecute(Void result) { super.onPostExecute(result); AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setTitle("Важное сообщение!") .setView(R.layout.captcha_layout); AlertDialog alert = builder.create(); alert.show(); Picasso.with(MainActivity.this).load(captchaImg).into(img); } Toast.makeText(MainActivity.this, "Вызов onPostExecute()", Toast.LENGTH_SHORT).show(); txt_percentage.setText(accesToken); btn_start.setEnabled(true); } captchaImg - contains uri images, there are no problems here, it loads.

onPostExecute(...)img == null? - post_zeewonCreate(...)it notnull? - post_zeewImageView. - post_zeew