I believe I have all my code in order but ive been toiling over this error for a few hours now. Im trying to setup a basic app framework using fragments. I can get the code to work if i structure the project as activity based and put the string data along with the block of code below in my MainActivity, but that doesnt help me as I try to move them to fragments.

In MainActivity (where the same block of code works without using fragments) it is placed in onCreate but it makes no difference if i place it there in the Fragment and I read that placing it in onCreate is not the proper place.

Im new to Android development, if you could explain your answer with a code example it would help greatly.

Thank you for taking the time to look.

My Entire Fragment is below.

```
public class BasicsPageFragment extends Fragment  {

RecyclerView recyclerView;
private Recycler_View_Adapter adapter;

public BasicsPageFragment() {
    // Required empty public constructor
}

@Override
public void onCreate(Bundle savedInstanceState) {

}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this

    View rootView = inflater.inflate(R.layout.recycler_view, container, false);

    RecyclerView rv = (RecyclerView) rootView.findViewById(R.id.fragment_container);
    rv.setHasFixedSize(true);

    LinearLayoutManager llm = new LinearLayoutManager(getActivity());
    rv.setLayoutManager(llm);

    return rootView;
}

@Override
protected void onViewCreated(Bundle savedInstanceState) {

    // below I am receiving an error (cannot resolve method 'getApplication()'
    // the line of code above it is also throwing "getView() in Fragment cannot be applied"
    // and savedInstanceState says "OnViewCreated (android.view.View, Bundle)
    // in Fragment cannot be applied to (android.os.Bundle)"
    super.onViewCreated(savedInstanceState);

    List<CardviewData> data = fill_with_data();
    recyclerView = (RecyclerView) getView(R.id.fragment_container);
    adapter = new Recycler_View_Adapter(data, getApplication());
    recyclerView.setAdapter(adapter);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));

    //  errors stop here

}

//Create a list of CardviewData objects
public List<CardviewData> fill_with_data() {

    List<CardviewData> data = new ArrayList<>();

    data.add(new CardviewData("Batman vs Superman", "Following the destruction of Metropolis, Batman embarks on a personal vendetta against Superman ", R.drawable.ic_action_movie));
    data.add(new CardviewData("X-Men: Apocalypse", "X-Men: Apocalypse is an upcoming American superhero film based on the X-Men characters that appear in Marvel Comics ", R.drawable.ic_action_movie));
    data.add(new CardviewData("Captain America: Civil War", "A feud between Captain America and Iron Man leaves the Avengers in turmoil.  ", R.drawable.ic_action_movie));
    data.add(new CardviewData("Kung Fu Panda 3", "After reuniting with his long-lost father, Po  must train a village of pandas", R.drawable.ic_action_movie));
    data.add(new CardviewData("Warcraft", "Fleeing their dying home to colonize another, fearsome orc warriors invade the peaceful realm of Azeroth. ", R.drawable.ic_action_movie));
    data.add(new CardviewData("Alice in Wonderland", "Alice in Wonderland: Through the Looking Glass ", R.drawable.ic_action_movie));

    return data;
}
}

```

In case you need the Adapter...

```
public class Recycler_View_Adapter extends RecyclerView.Adapter<CardviewViewHolder> {

List<CardviewData> list = Collections.emptyList();
Context context;

public Recycler_View_Adapter(List<CardviewData> list, Context context) {
    this.list = list;
    this.context = context;
}

@Override
public CardviewViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.cardview_layout, parent, false);
    CardviewViewHolder holder = new CardviewViewHolder(v);
    return holder;
}

@Override
public void onBindViewHolder(CardviewViewHolder holder, int position) {
    holder.title.setText(list.get(position).title);
    holder.description.setText(list.get(position).description);
    holder.imageView.setImageResource(list.get(position).imageId);

}

@Override
public int getItemCount() {
    return list.size();
}

@Override
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
    super.onAttachedToRecyclerView(recyclerView);
}

// Insert a new item to the RecyclerView
public void insert(int position, CardviewData data) {
    list.add(position, data);
    notifyItemInserted(position);
}
// Remove a RecyclerView item containing the CardviewData object
public void remove(CardviewData data) {
    int position = list.indexOf(data);
    list.remove(position);
    notifyItemRemoved(position);
}
}

```