title: haw to insert an Image of base64 from database to recycleView
body: <p>I'm building a recycle view that gets API information, It works fine but until now I used an Image from my drawable folder but I need to change it with a base64 (in form String) Image from my API.</p>
  
  <p>then guys how to change my code to make recycle get API image. </p>
  
  <p>NewsItem.class</p>
  
  <pre><code>    public class NewsItem {
  
          String Title,Content,Date,type_col;
          int userPhoto;
          public  NewsItem(){
  
          }
  
          public NewsItem(String title, String content, String date, String type_col, int userPhoto) {
              Title = title;
              Content = content;
              Date = date;
              this.type_col = type_col;
              this.userPhoto = userPhoto;
          }
  
          public String getType_col() {
              return type_col;
          }
  
          public void setType_col(String type_col) {
              this.type_col = type_col;
          }
  
          public void setTitle(String title) {
              Title = title;
          }
  
          public void setContent(String content) {
              Content = content;
          }
  
          public void setDate(String date) {
              Date = date;
          }
  
          public void setUserPhoto(int userPhoto) {
              this.userPhoto = userPhoto;
          }
  
          public String getTitle() {
              return Title;
          }
  
          public String getContent() {
              return Content;
          }
  
          public String getDate() {
              return Date;
          }
  
          public int getUserPhoto() {
              return userPhoto;
          }
      }
  </code></pre>
  
  <p>newsadapter:</p>
  
  <pre><code>public class NewsAdapter extends RecyclerView.Adapter&lt;NewsAdapter.NewsViewHolder&gt; {
  
      Context mContext;
      List&lt;NewsItem&gt; mData;
  
      public NewsAdapter(Context mContext, List&lt;NewsItem&gt; mData) {
          this.mContext = mContext;
          this.mData = mData;
      }
  
      @NonNull
      @Override
      public NewsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
          View layout = LayoutInflater.from(mContext).inflate(R.layout.item_news,parent,false);
  
          return new NewsViewHolder(layout);
      }
  
      @Override
      public void onBindViewHolder(@NonNull NewsViewHolder newsViewHolder, int position) {
          //bind data
          newsViewHolder.tv_title.setText(mData.get(position).getTitle());
          newsViewHolder.tv_description.setText(mData.get(position).getContent());
          newsViewHolder.tv_date.setText(mData.get(position).getDate());
          newsViewHolder.tv_type_col.setText(mData.get(position).getType_col());
          newsViewHolder.img_user.setImageResource(mData.get(position).getUserPhoto());
  
      }
  
      @Override
      public int getItemCount() {
          return mData.size();
      }
  
      public class NewsViewHolder extends RecyclerView.ViewHolder{
  
          TextView tv_title,tv_description,tv_date,tv_type_col;
          ImageView img_user;
  
          public NewsViewHolder(@NonNull View itemView) {
              super(itemView);
              tv_title = itemView.findViewById(R.id.tv_title);
              tv_description = itemView.findViewById(R.id.tv_description);
              tv_date = itemView.findViewById(R.id.tv_date);
              tv_type_col = itemView.findViewById(R.id.tv_type_col);
              img_user = itemView.findViewById(R.id.img_user);
          }
      }
  }
  </code></pre>
  
  <p>Main fragment:</p>
  
  <pre><code>RecyclerView NewsRecyclerview;
      NewsAdapter newsAdapter;
      List&lt;NewsItem&gt; mData;
  
  
   public View onCreateView(@NonNull LayoutInflater inflater,
                               ViewGroup container, Bundle savedInstanceState) {
  
  NewsRecyclerview = root.findViewById(R.id.news_rv);
          mData = new ArrayList&lt;&gt;();
  
          getd("all");}
  
      private void getd(String selector){//, final GalleryFragment.MarkerLoadCallBack markerLoadCallBack
          Retrofit retrofit = new Retrofit.Builder()
                  .baseUrl(Api.BASE_URL)
                  .addConverterFactory(GsonConverterFactory.create()) //Here we are using the GsonConverterFactory to directly convert json data to object
                  .build();
  
          Api api = retrofit.create(Api.class);
  
          Call&lt;List&lt;col&gt;&gt; call = api.getHeroes(selector);
  
          call.enqueue(new Callback&lt;List&lt;col&gt;&gt;() {
              @Override
              public void onResponse(Call&lt;List&lt;col&gt;&gt; call, Response&lt;List&lt;col&gt;&gt; response) {
                  // mker = new ArrayList&lt;&gt;();
                  List&lt;col&gt; colList = response.body();
                  for (col c : colList) {
                      Log.d("image : ", c.getImagePath() + "");
  
                      mData.add(new NewsItem(c.getNom_col().toString(),"L'email de Client est:" + c.getEmailcol()+"\n" +  "La matricule est :     \n"+ "Créer par "+ c.getCreator() + "\n"  ,"le "+c.getDate_creation_col().toString(),"Type:" + c.getType(),R.drawable.t));
                  }
                  newsAdapter = new NewsAdapter(getContext(),mData);
                  NewsRecyclerview.setAdapter(newsAdapter);
                  NewsRecyclerview.setLayoutManager(new LinearLayoutManager(getContext()));
  
              }
  </code></pre>
  
  <p>The String form image is c.getImagePath()</p>