tags:

views:

853

answers:

2

Hi,

I am trying to write an application, that would allow me to render multiple images onto an ImageView in Android. I can find the method to populate it with a sigle bitmap. But, there seems to be no way of getting two images to render in ImageView (Each occuping half the render space). Any help would be really appreciative.

Thanks, De Costo.

+4  A: 

What are you really trying to accomplish here?

If you are trying to write a game, consider SurfaceView.

If you are trying to have multiple images appear stacked on top of each other, consider FrameLayout.

Otherwise, you will have to find a third-party JAR that will allow you to combine your images outside of Android, then put the combined image in your ImageView.

CommonsWare
+4  A: 

You can try to create one single bitmap from the multiple images.

You can try to do it with the raw data, by extracting the pixel data from the images as 32-bit int ARGB pixel arrays, merge in one big array, and create a new Bitmap, using the methods of the Bitmap class like copyPixelsToBuffer(), createBitmap() and setPixels().

I think you can also do it by using directly compressed format data and streams and the methods of the BitmapFactory class like decodeByteArray().

If you aren't using too many images at once you can use separate ImageViews and recycle them/reload the resources. I had a pretty rough experience with something like that recently, but it can be done.

Good luck.

Dimitar Dimitrov