title: Fragment Load as Item in RecyclerView Adapter
body: <blockquote>
    <p>I have an Array with Dynamic Size and I want to load all elements of
    array in RecyclerView using adapter For Left to right and right to
    left Swipe Each Element Of array by Using RecyclerView and I added
    FrameLayout in Adapter View and created one Fragment and that Fragment
    mapped on Frame Layout in case of each index of array in adapter
    during Swipe onBindViewHolder(ViewHolder holder, int position) but
    this not worked for as slider I can used view pager but view pager not
    listen each index during swipe that's why i used recyclerview please
    help to load data in recycler view as slider and also help to load
    fragment adruptly during swiping </p>
    
    <p>Here Is Adapter Code</p>
  </blockquote>
  
  <pre><code>ArrayList&lt;CourseLessonDetailsData&gt; mCourseLessonDetailsDataList = new ArrayList&lt;&gt;();
          CourseDetailsActivity mActivity;
          FragmentManager mFragmentManager;
  
          public SwipeRecyclerViewAdapter(ArrayList&lt;CourseLessonDetailsData&gt; _courseLessonDetailsDataList , CourseDetailsActivity _activity, FragmentManager fragmentManager) {
              mActivity = _activity;
              mCourseLessonDetailsDataList = _courseLessonDetailsDataList;
              mFragmentManager = fragmentManager;
          }
  
          @Override
          public SwipeRecyclerViewAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
              // Create a new view by inflating the row item xml.
              View v = LayoutInflater.from(parent.getContext())
                      .inflate(R.layout.swipe_course_detail_recycler_item_view, parent, false);
  
              // Set the view to the ViewHolder
              return new SwipeRecyclerViewAdapter.ViewHolder(v);
          }
  
          @Override
          public void onBindViewHolder(ViewHolder holder, int position) {
  
                  FragmentManager fragmentManager = mActivity.getSupportFragmentManager();
                  FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
                  SwipeFragment swipeFragment = new SwipeFragment();
                  Bundle bundle = new Bundle();
                  bundle.putParcelableArrayList("course_lesson_array", mCourseLessonDetailsDataList);
                  bundle.putString("position", position + "");
                  swipeFragment.setArguments(bundle);
                  fragmentTransaction.add(R.id.swipe_recycler_view_frame_layout, swipeFragment);
                  fragmentTransaction.commit();
  
          }
  
          @Override
          public int getItemCount() {
              return mCourseLessonDetailsDataList.size();
          }
  
          // Create the ViewHolder class to keep references to your views public class ViewHolder extends RecyclerView.ViewHolder{
              public FrameLayout swipe_recycler_view_frame_layout;
  
              /*
               * Constructor
               * @param v The container view which holds the elements from the row item xml
               */
              public ViewHolder(View v) {
                  super(v);
  
                  swipe_recycler_view_frame_layout = v.findViewById(R.id.swipe_recycler_view_frame_layout);
  
  
              }
  
  
          }
  </code></pre>