Picasso Illegalargumentexception Target Must Not Be Null

Picasso IllegalArgumentException Target must not be null

image is the target passed to into. It is what's null.

Ensure that your layout IDs are correct for all configurations and specify @+id/details_image.

java.lang.IllegalArgumentException: Target must not be null at my logcat

When you call into() function the variable pro_image_profile_frag is null. Please check if it has been initialized before calling into() function. It should be something like this:

val pro_image_profile_frag = findViewById(R.id.view_id)

java.lang.IllegalArgumentException: Target must not be null. while using picasso lib

 View navHeader = navigationView.getHeaderView(0);
profilePictureView = (ImageView) navHeader.findViewById(R.id.personthumb);
username = (TextView) navHeader.findViewById(R.id.userName);
Glide.with(this).load(str).thumbnail(0.5f).into(profilePictureView);

Target must not be null using Picasso Library

The error occurs because holder.image is null - and into() specifically checks that the argument you pass in is not null.

When you use setTag()/getTag(), only a single object can be stored. Therefore when you call

view.setTag(holder);
view.setTag(holder1);

None of the data in holder is saved - it is replaced with holder1. Instead of having multiple ViewHolder, you should just add another field to your existing ViewHolder class:

class ViewHolder {
ImageView image;
TextView url;
TextView price;
}

Then you can use just a single ViewHolder:

holder = new ViewHolder();

holder.image = (ImageView) view.findViewById(R.id.photo);
holder.url = (TextView) view.findViewById(R.id.url);
holder.price = (TextView) view.findViewById(R.id.price);

view.setTag(holder);

Android-Picasso java.lang.IllegalArgumentException: Target must not be null. when the image view is in a custom layout for a alertdialog

You are forget to bind ImageView like ...

change in this line ...

  img_view1 = (ImageView)layout.findViewById(R.id.img_fullscreen);

Picasso - Target must not be null

Actually the reason why you aren't getting any data is your database reference. Inside your database structure you have a child called "Foods" where as the child you are fetching is "foods". Change

foods = database.getReference("foods");

to

foods = database.getReference("Foods");



Related Topics



Leave a reply



Submit