title: Set image inside RecyclerView from Adapter
body: <p>So I have a list of States in my RecyclerView and thats working.  But I want to add an image from my assets folder, that is at the same level as the res folder not a sub-folder, to the left side of the text and that is not working.</p>
  
  <p>My layout file is as follows:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:paddingBottom="5dp"
  android:paddingTop="5dp"&gt;
  
  &lt;ImageView
      android:id="@+id/state_Icon_View"
      android:layout_width="50dp"
      android:layout_height="50dp"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:layout_centerVertical="true"
      tools:ignore="HardcodedText" /&gt;
  
  &lt;TextView
      android:id="@+id/state_Item"
      android:layout_width="wrap_content"
      android:layout_height="50dp"
      android:layout_centerVertical="true"
      android:layout_marginLeft="@dimen/activity_horizontal_margin"
      android:layout_marginStart="@dimen/activity_horizontal_margin"
      android:layout_toEndOf="@+id/state_Icon_View"
      android:layout_toRightOf="@+id/state_Icon_View"
      android:text="The State"
      android:textColor="#000000"
      android:textSize="24sp"
      tools:ignore="HardcodedText" /&gt;
  </code></pre>
  
  <p>
  Here is my Data Provider:</p>
  
  <pre><code>import android.widget.ImageView;
  
  public class StateDataProvider
  {
  private String state;
  private ImageView image;
  
  public StateDataProvider(String state)
  {this.setState(state);}
  
  public StateDataProvider(ImageView image)
  {this.setImage(image);}
  
  public String getState() {
      return state;
  }
  
  public ImageView getImage() {
      return image;
  }
  
  public void setState(String state)
  {
      this.state = state;
  }
  
  public void setImage(ImageView image)
  {
      this.image = image;
  }
  }
  </code></pre>
  
  <p>And finally here is my Adapter:</p>
  
  <pre><code>public class StateRecyclerAdapter extends RecyclerView.Adapter &lt;StateRecyclerAdapter.RecyclerViewHolder&gt; {
  
  private ArrayList&lt;StateDataProvider&gt; arrayList = new ArrayList&lt;StateDataProvider&gt;();
  
  private Context context;
  
  public StateRecyclerAdapter(Context context, ArrayList&lt;StateDataProvider&gt; arrayList )
  {
      this.arrayList = arrayList;
      this.context = context;
  
  }
  
  private String theStateIcon;
  
  @Override
  public RecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  
      View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.state_layout,parent,false);
  
      RecyclerViewHolder recyclerViewHolder = new RecyclerViewHolder(view);
  
      return recyclerViewHolder;
  }
  
  @Override
  public void onBindViewHolder(StateRecyclerAdapter.RecyclerViewHolder holder, int position) {
      StateDataProvider data_provider = arrayList.get(position);
  
      holder.state.setText(data_provider.getState());
  
      String whichState =  data_provider.getState();
      switch (whichState) {
          case "New South Wales":
              theStateIcon = "NSW_icon.png";
          case "Victoria":
              theStateIcon = "VIC_icon.png";
          case "Queensland":
              theStateIcon = "QLD_icon.png";
          case "Tasmania":
              theStateIcon = "TAS_icon.png";
          case "South Australia":
              theStateIcon = "SA_icon.png";
          case "Northern Territory":
              theStateIcon = "NT_icon.png";
          case "Western Australia":
              theStateIcon = "WA_icon.png";
      }
  
      int resourceId = context.getResources().getIdentifier(theStateIcon, "assets", "au.com.itmobilesupport.sqltwo");
      holder.state_Icon.setImageDrawable(ContextCompat.getDrawable(context,resourceId));
  
  }
  
  @Override
  public int getItemCount() {
      return arrayList.size();
  }
  
  public static class RecyclerViewHolder extends RecyclerView.ViewHolder
  {
      TextView state;
      ImageView state_Icon;
  
      public RecyclerViewHolder(View view) {
          super(view);
          state = (TextView)view.findViewById(R.id.state_Item);
          state_Icon = (ImageView) view.findViewById(R.id.state_Icon_View);
          }
  }
  }
  </code></pre>
  
  <p>So I am trying to get the context and then set the image for the Imageview but when I try and get the context I get the following error:</p>
  
  <pre><code>Error:(48, 19) error: constructor StateRecyclerAdapter in class 
  StateRecyclerAdapter cannot be applied to given types;
  required: Context,ArrayList&lt;StateDataProvider&gt;
  found: ArrayList&lt;StateDataProvider&gt;
  reason: actual and formal argument lists differ in length
  </code></pre>
  
  <p>EDIT: Here is my StatePage.java </p>
  
  <pre><code>public class StatePage extends AppCompatActivity  {
  
  private Cursor reefs;
  private MyDatabase db;
  private String chosenState;
  RecyclerView recyclerView;
  RecyclerView.Adapter adapter;
  RecyclerView.LayoutManager layoutManager;
  ArrayList&lt;StateDataProvider&gt; arrayList = new 
  ArrayList&lt;StateDataProvider&gt;();
  StateDataProvider dataprovider;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_state_page);
      db = new MyDatabase(this);
  
      reefs = db.getStateData(); 
  
      do{
          dataprovider = new StateDataProvider(reefs.getString(1));
          arrayList.add(dataprovider);
  
      } while (reefs.moveToNext());
  
      recyclerView = (RecyclerView)findViewById(R.id.recycler_view);
      recyclerView.setHasFixedSize(true);
  
      layoutManager = new LinearLayoutManager(this);
      recyclerView.setLayoutManager(layoutManager);
  
      adapter = new StateRecyclerAdapter(arrayList);
      recyclerView.setAdapter(adapter);
  
      recyclerView.addOnItemTouchListener(
              new MyRecyclerViewClickListener(this, new 
  MyRecyclerViewClickListener.OnItemClickListener() {
                  @Override
                  public void onItemClick(View view, int position) {
                      chosenState = arrayList.get(position).getState();
                      goToRegionPage();
  //                        System.out.println("State is" + 
  arrayList.get(position).getState());
                  }
              })
      );
  }
  public void goToRegionPage()
  {
      Intent intent = new Intent(this, RegionPage.class);
      intent.putExtra("theState", chosenState);
      startActivity(intent);
  }
  }
  </code></pre>