title: Android gridview maintain the state when changes orientation but need to update views
body: <p>Am having a gridview which sets the views based on the gridview size and the col width, everything fine when we start but when i change the orientation, the views are recreated and the check boxes which are checked are refreshed, which i dont want. I need to maintain the scrolled sate as well the check box state.</p>
  
  <p>Here is my code in getview:</p>
  
  <pre><code>public View getView(int position, View convertView, ViewGroup parent) {
              ViewHolder holder;
              if (convertView == null) {
                  holder = new ViewHolder();
                  convertView = mInflater.inflate(R.layout.galleryitem, null);
                  holder.imageview = (ImageView) convertView.findViewById(R.id.thumbImage);
                  holder.checkbox = (CheckBox) convertView.findViewById(R.id.itemCheckBox);
  
                  convertView.setTag(holder);
              } else {
                  holder = (ViewHolder) convertView.getTag();
              }
              ImageItem item = images.get(position);
              holder.checkbox.setId(position);
              holder.imageview.setId(position);
              holder.checkbox.setOnClickListener(new OnClickListener() {
  
                  public void onClick(View v) {
                      // TODO Auto-generated method stub
                      CheckBox cb = (CheckBox) v;
                      int id = cb.getId();
                      if (images.get(id).selection) {
                          cb.setChecked(false);
                          images.get(id).selection = false;
                      } else {
                          cb.setChecked(true);
                          images.get(id).selection = true;
                      }
                  }
              });
              holder.imageview.setOnClickListener(new OnClickListener() {
  
                  public void onClick(View v) {
                      // TODO Auto-generated method stub
                      int id = v.getId();
                      ImageItem item = images.get(id);
                      Intent intent = new Intent();
                      intent.setAction(Intent.ACTION_VIEW);
                      final String[] columns = { MediaStore.Images.Media.DATA };
                      Cursor imagecursor = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
                              columns, MediaStore.Images.Media._ID + " = " + item.id, null, MediaStore.Images.Media._ID);
                      if (imagecursor != null &amp;&amp; imagecursor.getCount() &gt; 0) {
                          imagecursor.moveToPosition(0);
                          String path = imagecursor.getString(imagecursor
                                  .getColumnIndexOrThrow(MediaStore.Images.Media.DATA));
                          File file = new File(path);
                          imagecursor.close();
                          intent.setDataAndType(Uri.fromFile(file), "image/*");
                          startActivityForResult(intent, VIEW_IMAGE);
                      }
                  }
              });
              // holder.imageview.setImageBitmap(item.img);
              holder.imageview.setLayoutParams(mImageViewLayoutParams);
  
              // Check the height matches our calculated column width
              if (holder.imageview.getLayoutParams().height != mItemHeight) {
                  holder.imageview.setLayoutParams(mImageViewLayoutParams);
              }
              bitmapFromId.DisplayImage(item.id, holder.imageview);
              // holder.imageview.setImageBitmap(item.img);
              holder.checkbox.setChecked(item.selection);
              return convertView;
          }
  </code></pre>
  
  <p>If i set the android:configChanges="orientation" it does not update my views in the Grid</p>