title: First item of Recyclerview duplicate twice
body: <p>i'm trying to display images from a particular folder (3 images) and store them in <code>Recyclerview</code> using code below , But the first item of  <code>Recyclerview</code> repeated twice ,appears in the first and last item and the last item not showing like the picture below : </p>
  
  <p><a href="https://i.stack.imgur.com/HYM49.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HYM49.jpg" alt="enter image description here"></a></p>
  
  <p><strong>MyAdapter</strong></p>
  
  <pre><code>public class MyAdapter extends RecyclerView.Adapter&lt;MyViewHolder&gt; {
  
      Context c;
      ImageView img;
      ArrayList&lt;Spacecraft&gt; spacecrafts;
  
      public MyAdapter(Context c, ArrayList&lt;Spacecraft&gt; spacecrafts) {
          this.c = c;
          this.spacecrafts = spacecrafts;
      }
  
      @Override
      public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View v = LayoutInflater.from(c).inflate(R.layout.picture_item, parent, false);
          img = (ImageView) v.findViewById(R.id.cat_imageView);
          return new MyViewHolder(v);
      }
  
      @Override
      public long getItemId(int position) {
          return position;
      }
  
      @Override
      public int getItemViewType(int position) {
          return position;
      }
  
      @Override
      public void onBindViewHolder(MyViewHolder holder, int position) {
          Spacecraft s = spacecrafts.get(position);
          Glide.with(c).load(s.getUri()).into(img);
      }
  
      @Override
      public int getItemCount() {
          return spacecrafts.size();
      }
  
  }
  </code></pre>
  
  <p><strong>MainActivity</strong></p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity);
          /**/
          recyclerView = (RecyclerView) findViewById(R.id.rc);
          layoutManager = new GridLayoutManager(WallpaperAutoChanger.this, 2);
          recyclerView.setLayoutManager(layoutManager);
          recyclerView.setHasFixedSize(true);
          recyclerView.setAdapter(new MyAdapter(this, getData()));
         /**/
  }
  }
    private ArrayList&lt;Spacecraft&gt; getData() {
          ArrayList&lt;Spacecraft&gt; spacecrafts = new ArrayList&lt;&gt;();
          File downloadsFolder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES + "/wallpapers");
          Spacecraft s;
          if (downloadsFolder.exists()) {
              File[] files = downloadsFolder.listFiles();
              for (File file : files) {
                  s = new Spacecraft();
                  s.setName(file.getName());
                  s.setUri(Uri.fromFile(file));
                  spacecrafts.add(s);
              }
          }
          return spacecrafts;
      }
  </code></pre>
  
  <p>can someone help me to resolve this issue.</p>