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
Adt Doesn't Create Default Hello World But Command Line Does
Convert Time Value to Format "Hh:Mm Am/Pm" Using Android
Can't Upload Updated APK to Google Play Due to Different Certificate
Connecting Android with Ms SQL Server 2008
Findviewbyid() Returns Null for Views in a Dialog
How to Correctly Start Activity from Postexecute in Android
Android Tabhost Change Text Color Style
Android/Firebase - Error While Parsing Timestamp in Gcm Event - Null Timestamp
Android; Geocoder, Why Do I Get "The Service Is Not Available"
Debug Native Code in Android Library
Mpandroid Chart Not Displaying Any Labels for Xaxis , What Is Missing
How to Customize Listview Row Android
Update Text of Notification, Not Entire Notification
Project Has No Default.Properties File! Edit the Project Properties to Set One
Detect If an App Is Installed from Play Store
Upgraded to Android Studio 3.4 - Aapt2Internalexception: Aapt2: Daemon Startup Failed