I\'m trying to set image by using Picasso library on my project.
When I click image of the View,I\'m getting an error on Picasso execution.
Logcat of the ap
Check the ID of your imageview object is correct -
imageView=itemView.findViewById(R.id.imageview1);
Check Id which you set in your layout file.
android:id="@+id/details_image"
Then,
ImageView image = (ImageView) coverView.findViewById(R.id.details_image);
make sure you inflating the correct xml That was my problem since I copied an already existing adapter and forgot to change that
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(context)
.inflate(R.layout.list_item_subcategories, parent, false);
Where the layout I should have put was list_item_categories
Maybe painting.getImageId() is empty or null?
Or image or getActivity()? :)
I know this is a little bit old, but one thing that I just spent a bunch of time on is forgetting to run "setContentView" to the layout that the image was on.
The ImageView is going to be null until the main layout that it lives on is inflated ;)
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
.