title: Android GridView with database
body: <p>I've got problem with my grid view. I would like to store images in table and then display them in grid view.</p>
  
  <pre><code> // ImageAdapter
  
      String[] strings = db.getPictures();
      Integer[] ints = new Integer[strings.length];
      for (int i=0; i &lt; strings.length; i++) {
          ints[i] = Integer.parseInt(strings[i]);
      }
      imageView.setImageResource(ints[position]);
      return imageView;
  
  
     //DatabaseHandler
  
   public String[] getPictures(){
      int i=0;
  
      String selectQuery = "SELECT pictureName FROM Category";
      SQLiteDatabase db = this.getReadableDatabase();
      Cursor c = db.rawQuery(selectQuery, null);
      int rowsNumber=c.getCount();
      String[] mThumbIds;
      mThumbIds= new String[rowsNumber];
  
      if (c.moveToFirst()) {
          do {
              mThumbIds[i]=c.getString(0);
              i++;
          } while (c.moveToNext());
      }
  
      return mThumbIds;
  }
  </code></pre>
  
  <p>And when i run my app it crush at starting. Single string I save like <code>R.drawable.ic_work</code></p>