目标必须不为空(在对话框中加载带有 Picasso 的 ImageView)

Target must be not null (Load an ImageView with Picasso on Dialog)

我有日志猫说的问题target must be no null 我想使用 Picasso Loader 通过 onclick 按钮在对话框中显示图像。 这是我的代码

viewsim.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Toast.makeText(DetailBookingAdmin.this, ""+pathSIM, Toast.LENGTH_SHORT).show();
            final Dialog dialog = new Dialog(DetailBookingAdmin.this);
            dialog.setContentView(R.layout.view_sim);
            dialog.setTitle("SIM");
            final ImageView imgsim = (ImageView)v.findViewById(R.id.img_sim);
           Picasso.with(v.getContext()).load(pathSIM).into(imgsim);
            dialog.show();
        }
    });

日志猫在行Picasso.with(v.getContext()).load(pathSIM).into(imgsim); 目标必须不为空。请帮助我,提前致谢。

使用布局充气器。

LayoutInflater inflater = getLayoutInflater();
View newView = (View) inflater.inflate(R.layout.view_sim, null);

dialog.setContentView(newView);
final ImageView imgsim = (ImageView)newView.findViewById(R.id.img_sim);
...