Android displaying images in row to a certain percentage
===

I have a blank linear list, I've got a list of images that will load dynamically (from url's, working).

I need to display the images in a grid (like when you access facebook photo gallery).

I can't use XML for obvious reasons, I've got the images displaying just they are on-top of each other and really small.

Also is it possible to set them to a percentage of the screen size easy? (So the list looks the same on all devices)

Here's the code so far:

        for(int _i = 0; _i < _noOfPhotos; _i++)
		{
			ImageView imageView = new ImageView(getApplicationContext());
			imageView.setImageResource(R.drawable.no_image);
			_imageViewArray.add(imageView);
			
			LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(500, 500);
			
			this.addContentView(_imageViewArray.get(_i), lp);
		}