title: How to setup a @BindingAdapter with Picasso?
body: <p>I would like to create a gridview of movie posters images with using bindings.</p>
  
  <p>My viewmodel looks like that:</p>
  
  <pre><code>public class PopularMoviesViewModel extends BaseObservable {
  
      Movie movie;
      Context context;
  
      MovieServiceComponent movieServiceComponent = DaggerMovieServiceComponent.builder()
              .contextModule(new ContextModule(context))
              .build();
  
      Picasso getPicasso = movieServiceComponent.getPicasso();
  
      public PopularMoviesViewModel(Movie movie, Context context) {
          this.movie = movie;
          this.context = context;
      }
  
      @Bindable
      public String getImageUrl(){
          return movie.posterPath();
      }
  
      @Bindable
      public String getTitle(){
          return movie.originalTitle();
      }
  
      @BindingAdapter({"imageUrl"})
      public void setImageUrl(ImageView view, String poserPath){
          getPicasso.with(view.getContext()).load("http://image.tmdb.org/t/p/w185"+ poserPath).into(view);
  
      }
  
  }
  </code></pre>
  
  <p>Layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layout xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
      &lt;data class="PopularMoviesBinding"&gt;
      &lt;variable
          name="pmvm"
          type="com.hartyandi.oviesm.modelviews.PopularMoviesViewModel"&gt;&lt;/variable&gt;
  
      &lt;/data&gt;
  
      &lt;LinearLayout
  
  
          android:id="@+id/row"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="#FFFFFF"
          android:paddingBottom="0dp"
          android:paddingTop="5dp"
          android:paddingRight="2.5dp"
          android:paddingLeft="5dp"
          android:orientation="vertical"&gt;
  
          &lt;ImageView
              app:imageUrl="@{pmvm.imageUrl}"
              android:id="@+id/popular_movies_grid_image"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:padding="0dp"
              android:adjustViewBounds="true"
              android:elevation="20dp"&gt;
  
          &lt;/ImageView&gt;
  
          &lt;TextView
              android:id="@+id/popular_movies_grid_text"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="@{pmvm.title}"
              android:textColor="#000000"
              android:textSize="12sp"
              android:background="#FFFFFF"
              &gt;
          &lt;/TextView&gt;
  
      &lt;/LinearLayout&gt;
  &lt;/layout&gt;
  </code></pre>
  
  <p>Adapter:</p>
  
  <pre><code>public class PopularMoviesAdapter extends RecyclerView.Adapter&lt;PopularMoviesAdapter.BindingHolder&gt; {
  
      private List&lt;Movie&gt; movies;
      private Context context;
  
      public PopularMoviesAdapter(List&lt;Movie&gt; movies, Context context) {
          this.movies = movies;
          this.context = context;
      }
  
      public void add(Movie movie){
          movies.add(movie);
      }
  
      @Override
      public BindingHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          PopularMoviesBinding popularMoviesBinding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()),
                  R.layout.popular_movies_gridview_row, parent,false);
          return new BindingHolder(popularMoviesBinding);
      }
  
      @Override
      public void onBindViewHolder(PopularMoviesAdapter.BindingHolder holder, int position) {
          PopularMoviesBinding popularMoviesBinding = holder.popularMoviesBinding;
          popularMoviesBinding.setPmvm(new PopularMoviesViewModel(movies.get(position), context));
      }
  
      @Override
      public int getItemCount() {
          return movies.size();
      }
  
      public class BindingHolder extends RecyclerView.ViewHolder{
  
          private PopularMoviesBinding popularMoviesBinding;
  
          public BindingHolder(PopularMoviesBinding popularMoviesBinding) {
              super(popularMoviesBinding.getRoot());
              this.popularMoviesBinding = popularMoviesBinding;
          }
   }
  }
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>java.lang.IllegalStateException: Required DataBindingComponent is null in class PopularMoviesBinding.A BindingAdapter in modelviews.PopularMoviesViewModel is not static and requires an object to use, retrieved from the DataBindingComponent. 
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/33904519/how-do-i-change-an-observable-field-from-inside-a-bindingadapter-in-android-data">I tried to change my implementation just like this stackoverflow post suggest</a> and I got the same error message.</p>
  
  <p><a href="https://barta.me/android-mvvm-pattern/" rel="nofollow noreferrer">I also used the following code as example.</a></p>
  
  <p>Could someone explain what the problem with the code, and how to solve it?</p>