0
私はjava.lang.IllegalArgumentException: Target must not be null
を持っています。イメージをダウンロードしてimageView
By picassoライブラリに入れようとすると、私はあなたに私のコードを表示してみましょう:Android-Picasso java.lang.IllegalArgumentException:ターゲットをnullにすることはできません。イメージビューがアラートダイアログのカスタムレイアウトにあるとき
public class ads_show extends AppCompatActivity {
private Toolbar toolbar;
private ImageView img_view1;
private HashMap<String, Object> hmap;
private ImageView img;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ads_show);
getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
img = (ImageView) findViewById(R.id.ads_show_img);
TextView title = (TextView) findViewById(R.id.title_ads_show);
TextView desc = (TextView) findViewById(R.id.desc_ads_show);
TextView seller = (TextView) findViewById(R.id.seller_ads_show);
TextView phone = (TextView) findViewById(R.id.phone_ads_show);
TextView email = (TextView) findViewById(R.id.mail_ads_show);
TextView date = (TextView) findViewById(R.id.date_ads_show);
Bundle ads = getIntent().getExtras();
hmap = (HashMap<String, Object>) ads.get("ads");
Picasso.with(this).load((String) hmap.get("image_path"))
.resize(300, 150)
.into(img);
title.setText((String) hmap.get("title"));
desc.setText((String) hmap.get("description"));
seller.setText((String) hmap.get("seller"));
phone.setText((String) hmap.get("phone"));
email.setText((String) hmap.get("email"));
date.setText((String) hmap.get("date"));
}
public void onFullScreenClick(View v) {
try {
LayoutInflater inflater = (LayoutInflater) getApplicationContext().getSystemService(getApplicationContext().LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.fullscreen_image_show,null);
img_view1 = (ImageView) findViewById(R.id.img_fullscreen);
Picasso.with(this).load((String)hmap.get("image_path")).into(img_view1);
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setView(layout);
alert.setCancelable(true);
alert.setNeutralButton("exit", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
alert.show();
} catch (Exception e) {
Log.i("app_error", "Full screen" + e.toString());
}
}
public void onBtnBackClick(View v) {
finish();
}
}
私の問題はonFullScreenClick
方法です。 onCreate
メソッドの画像ビューは正常に動作します。
はどうもありがとうございました。私は完全にバインドすることを忘れない:) –