title: Why items change order upon scrolling in Android GridView?
body: <p>I have a GridView in android which I fill it with data retrieved from a xml resource.<br>
  For example I have 15 items in the GridView which are placed in order. The overall height exceeds the Screen height so i have to scroll to see the rest of the items.<br>
  The problem is when I scroll back up, the order of the invisible rows have changed. It's a mysterious behavior as sometimes items swap rows with each other.
  Here is my <code>getView</code> method:</p>
  
  <pre><code>public class ImageAdapter extends BaseAdapter {
          public ImageAdapter(Context c, NodeList cuu) {
                  cu = cuu;
          }
          public int getCount() {
                  Log.d("Node Count",cu.getLength()+"");
                  return cu.getLength();
          }
          public Object getItem(int position) {
                  return position;
          }
          public long getItemId(int position) {
                  return position;
          }
          public View getView(int position, View convertView, ViewGroup parent) {
                  View myView = convertView;
                  if (convertView == null) {
                      Node nd = cu.item(position);
                      Log.d("nodes","Pos: "+(position)+" Name: "+nd.getNodeName()+" Title: "+nd.getAttributes().getNamedItem("title").getTextContent());
                      int catID = Integer.parseInt(nd.getAttributes().getNamedItem("id").getTextContent());
                      LayoutInflater li = getLayoutInflater();
                      myView = li.inflate(R.layout.grid_item, null);
                     ImageView imageView = (ImageView) myView.findViewById(R.id.grid_item_image);
                     myView.setLayoutParams(new GridView.LayoutParams(70, 100));
                     id.download(nd.getAttributes().getNamedItem("icon").getTextContent(),imageView);
                     TextView textView = (TextView) myView.findViewById(R.id.grid_item_text);
                     textView.setText(nd.getAttributes().getNamedItem("title").getTextContent());
                     myView.setTag((Object) catID);
                  }else{
                      //Log.d("nodes","Pos: "+(position));
                  }
                  return myView;
          }
          private NodeList cu = null;
      }
  </code></pre>
  
  <p><strong>Update:</strong> Well, it's rather odd. After some more debugging I noticed that in the GridView, the Adapter skips the 13th position, meaning it returns 1 instead of 13 and then moves on to 14!!! (I guess the 13 is bad luck!)</p>