@Override
  public Fragment getItem(int position) {
    GridDetail launcherGridDetail = new GridDetail(mLauncherGridDetail);
    Bundle args = new Bundle();

    int maxIndex = totalGridList.size() - 1;
    int startPosition =
        Math.min((position * launcherGridDetail.getItemCountPerFragment()), maxIndex);

    int endPosition =
        Math.min(((position + 1) * launcherGridDetail.getItemCountPerFragment() - 1), maxIndex);

    launcherGridDetail.setStartPosition(startPosition);
    launcherGridDetail.setEndPosition(endPosition);
    launcherGridDetail.setCurrentGridPosition(position);
    args.putSerializable(Constants.KEY_BUNDLE_LAUNCHER_DETAIL, launcherGridDetail);

    GridFragment f = new GridFragment();
    f.setArguments(args);
    return f;
  }
 @Override
 public int getCount() {
   return mLauncherGridDetail.getTotalNoOfFragments();
 }