RecyclerView in Fragment

0

here with another question I am doing an Android application and the problem is that when calling the RecyclerView I get this error:

  

E / RecyclerView: No adapter attached; skipping layout

But I do not know why I get this error and only go through the arrangement once, here I leave my code

 public class InicioFragment extends Fragment {
private static final String TAG = "Inicio";
protected String BASE_URL = "http://192.168.0.3/proyecto/";
private RecyclerView listView;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    final View v = inflater.inflate(R.layout.fragment_inicio, container, false);
    LinearLayoutManager linear = new LinearLayoutManager(inflater.getContext());
    linear.setOrientation(LinearLayoutManager.VERTICAL);
    listView = (RecyclerView)v.findViewById(R.id.tatuajeslist);
    listView.setHasFixedSize(true);
    listView.setLayoutManager(linear);

From what I've researched they say it's:

  

linear.setOrientation (LinearLayoutManager.VERTICAL);

But the truth is that I do not know what it is, others say it's the context, do not know if I have to see that I'm using Retrofit?

Someone who can help me please? Thank you very much.

    
asked by blaicer 06.03.2017 в 05:19
source

1 answer

3

throws you that error because you are not adding any adapter with the data to display and therefore has nothing to load and view.

You have to add a line of this type:

listView.setAdapter(tu_adapter);

And previously you should have created your adapter with the data to be displayed.

I leave a page where they explain it more in detail:

Using lists in Android wth ListView - Tutorial

Greetings.

    
answered by 06.03.2017 в 09:18