package com.cwainner.chris.recipecentral.adapters;

import android.content.Context;
import android.widget.ArrayAdapter;

/**
 * Created by Chris on 5/26/2017.
 */

public class RecipePagerAdapter extends ArrayAdapter {
    private Context context;
    private String[] recipes;

    public RecipePagerAdapter(Context context, int resource, String[] recipes){
        super(context, resource);
        this.context = context;
        this.recipes = recipes;
    }

    @Override
    public Object getItem(int position){
        String recipe = recipes[position];
        return recipe;
    }

    @Override
    public int getCount(){
        return recipes.length;
    }
}

package com.cwainner.chris.recipecentral.adapters;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.cwainner.chris.recipecentral.models.Recipe;
import com.cwainner.chris.recipecentral.ui.RecipeDetailFragment;

import java.util.ArrayList;

public class RecipePagerAdapter extends FragmentPagerAdapter {
    private ArrayList<Recipe> recipes;

    public RecipePagerAdapter(FragmentManager fm, ArrayList<Recipe> recipes){
        super(fm);
        this.recipes = recipes;
    }

    @Override
    public Fragment getItem(int position){
        return RecipeDetailFragment.newInstance(recipes.get(position));
    }

    @Override
    public int getCount(){
        return recipes.size();
    }

    @Override
    public CharSequence getPageTitle(int position){
        return recipes.get(position).getTitle();
    }
}

Update Recipe Pager Adapter to handle fragments
Update Recipe Pager Adapter to handle fragments
