-1

sorry for asking this question again but i didnt get much help on the last one (maybe due to the holidays or because my question was a bit confusing). im trying to load images from the "drawable folder" into a gridview. unlike the "hello android gridview" tutorial i dont know the name of the images being loaded into the gridview (as the images will be added by the user at runtime). so, this array:

private Integer[] mThumbIds = {
    R.drawable.sample_2, R.drawable.sample_3,
    R.drawable.sample_4, R.drawable.sample_5,
    R.drawable.sample_6, R.drawable.sample_7,
    R.drawable.sample_0, R.drawable.sample_1,
    R.drawable.sample_2, R.drawable.sample_3,
    R.drawable.sample_4, R.drawable.sample_5,
    R.drawable.sample_6, R.drawable.sample_7,
    R.drawable.sample_0, R.drawable.sample_1,
    R.drawable.sample_2, R.drawable.sample_3,
    R.drawable.sample_4, R.drawable.sample_5,
    R.drawable.sample_6, R.drawable.sample_7

};

wont work, as i wont know the name of the images. im guessing ill need to use a for...each statement but im lost after that. thanks again for the help. happy holidays

jason

jason
  • 3,821
  • 10
  • 63
  • 120
  • possible duplicate of [Question about gridview and using array](http://stackoverflow.com/questions/1976225/question-about-gridview-and-using-array) – THelper Dec 18 '14 at 15:27

1 Answers1

1

You need to write a custom adapter that will load the images into the views that become the grid cells. Check out this tutorial:

http://developerlife.com/tutorials/?p=327

It uses a list view, but the concepts are the same.

CaseyB
  • 24,780
  • 14
  • 77
  • 112