package app.com.example.android.popularmovies;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.GridView;
import android.widget.ImageView;

import java.util.ArrayList;

public class MoviesFragment extends Fragment {

    ArrayAdapter<ImageView> moviesAdapter;
    public MoviesFragment() {
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        moviesAdapter = new ArrayAdapter<ImageView>(
                getActivity(),
                R.layout.grid_item_movies,
                R.id.grid_item_movies_imageview,
                new ArrayList<ImageView>());

        // Inflate the layout for this fragment
        View rootView = inflater.inflate(R.layout.fragment_movies, container, false);
        final GridView moviesGridView = (GridView) rootView.findViewById(R.id.gridview_movies);
        moviesGridView.setAdapter(moviesAdapter);
        return rootView;
    }
}

@@ -226,81 +226,12 @@
 get.
-ArrayAdapter;%0Aimport android.widget.GridView;%0Aimport android.widget.Image
+Grid
 View
@@ -318,38 +318,26 @@
     
-Array
+Movie
 Adapter
-%3CImageView%3E
  movie
-s
 Adap
@@ -648,230 +648,8 @@
 ) %7B%0A
-        moviesAdapter = new ArrayAdapter%3CImageView%3E(%0A                getActivity(),%0A                R.layout.grid_item_movies,%0A                R.id.grid_item_movies_imageview,%0A                new ArrayList%3CImageView%3E());%0A%0A
     
@@ -778,24 +778,25 @@
 false);%0A
+%0A
         
 final Gr
@@ -791,13 +791,88 @@
     
-final
+movieAdapter = new MovieAdapter(getActivity(), new ArrayList%3CMovie%3E());%0A%0A       
  Gri
@@ -989,17 +989,16 @@
 er(movie
-s
 Adapter)
@@ -999,16 +999,25 @@
 apter);%0A
+        %0A
         

Update MoviesFragment to use MovieAdapter