title: Troubles using fragment with RecyclerView and Retrofit
body: <p>I have this error, actually I don't know about fragments.</p>
  
  <p><em>CreatView</em></p>
  
  <pre><code>@Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          View rootView = inflater.inflate(R.layout.fragment_inicio, container,
                  false);
          getActivity().setTitle(R.string.inicio);
          recyclerView = (RecyclerView) rootView.findViewById(R.id.card_recycler_view);
          recyclerView.setHasFixedSize(true);
          RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
          recyclerView.setLayoutManager(layoutManager);
          loadJSON();
          return rootView;
      }
  </code></pre>
  
  <p><em>loadJSON void</em></p>
  
  <pre><code>private void loadJSON(){
      Retrofit retrofit = new Retrofit.Builder()
              .baseUrl("http://192.168.1.42:3000/")
              .addConverterFactory(GsonConverterFactory.create())
              .build();
      RequestInterface request = retrofit.create(RequestInterface.class);
      Call&lt;JSONResponse&gt; call = request.getJSON();
      call.enqueue(new Callback&lt;JSONResponse&gt;() {
          @Override
          public void onResponse(Call&lt;JSONResponse&gt; call, Response&lt;JSONResponse&gt; response) {
              JSONResponse jsonResponse = response.body();
              data = new ArrayList&lt;&gt;(Arrays.asList(jsonResponse.getCupon()));
              adapter = new CuponAdapter(data);
              recyclerView.setAdapter(adapter);
          }
  
          @Override
          public void onFailure(Call&lt;JSONResponse&gt; call, Throwable t) {
              Log.d("Error", t.getMessage());
          }
      });
  }
  </code></pre>
  
  <p><em>Adapter</em></p>
  
  <pre><code>public class CuponAdapter extends RecyclerView.Adapter&lt;CuponAdapter.ViewHolder&gt; {
  private ArrayList&lt;Cupon&gt; cupon;
  
  public CuponAdapter(ArrayList&lt;Cupon&gt; cupon) {
      this.cupon = cupon;
  }
  
  @Override
  public CuponAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
      View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.card_row, viewGroup, false);
      return new ViewHolder(view);
  }
  
  @Override
  public void onBindViewHolder(ViewHolder holder, int i) {
      holder.tv_titulo.setText(cupon.get(i).getTitulo());
      holder.tv_empresa.setText(cupon.get(i).getEmpresa());
      holder.tv_descripcion.setText(cupon.get(i).getDescripcion());
  }
  
  @Override
  public int getItemCount() {
      return cupon.size();
  }
  
  public class ViewHolder extends RecyclerView.ViewHolder {
      private TextView tv_titulo, tv_descripcion, tv_empresa;
  
      public ViewHolder(View view) {
          super(view);
          tv_titulo = (TextView) view.findViewById(R.id.tv_titulo);
          tv_descripcion = (TextView) view.findViewById(R.id.tv_descripcion);
          tv_empresa = (TextView) view.findViewById(R.id.tv_empresa);
      }
  }
  }
  </code></pre>
  
  <p><em>The Error</em></p>
  
  <blockquote>
    <p>12-08 00:00:05.727 1784-1784/com.mighty.cupoferta E/RecyclerView: No
    adapter attached; skipping layout</p>
  </blockquote>
  
  <p>This code is based on <a href="https://www.learn2crack.com/2017/03/searchview-with-recyclerview.html" rel="nofollow noreferrer">this</a> link .
  But he explains how to put in an activity, how can I put in a fragment?</p>