Hello All,
Brand new to Corona and had a question to pose to the Android experts that work with it. First of all I understand that this is more of a gaming development framework (for the most part). My question is for development on the Android platform. My application requires me to show frequently updating image data on multiple ImageViews.
So, basically I have a client/server Thrift connection with another service which sends my front end (Android UI code) that a render job has been completed and is now accessible in shared memory. The shared memory is where the byte or pixel data is located. These updates can come in at any time and usually come between 85ms - 1000ms intervals. So they can come in pretty frequently at times. What I then do is use the callback telling me that image data is available and use the memory location to pull in that image data. This data is held within an integer array (for pixel data). I then use the Java/Android API to convert that buffer into a bitmap and then set my ImageView to the new bitmap…
Now, as you can imagine my system can get quite taxed. Now, without changing the job update frequency (not possible) does Corona offer some optimizations over standard android in allowing me to convert this pixel data to a Bitmap (or something similar) then populating my imageView? Maybe seeing that the data hasn’t chagned so don’t trigger another update and paint the same image again? Most of the time the job update does not contain an updated or different image. Currently going through this whole process, Android doesn’t know any better so it will always try and update the ImageView. Here is a code snippet which should help in my explanation:
memoryClient.FetchBufferData(imageIntArray, getSharedMemoryName(), getSharedMemorySize() / 4); Bitmap.Config conf = Bitmap.Config.ARGB\_8888; final Bitmap maskBitmap = Bitmap.createBitmap(iconDim, iconDim, conf); maskBitmap.setPixels(imageIntArray, 0, iconDim, 0, 0, iconDim, iconDim);
that FetchBufferData populates my imageIntArray (array) with the image data. Its a native call used to establish the connection to the shared memory service and then obtains the image data based off of the memory name and size. I then go through the process of converting that to a Bitmap and then I use that bitmap and set it in the ImageView (not shown above but is just myImageView.setImageBitmap(maskBitmap)).
I am looking for a good solution to this problem since I feel like there is a more optimal way of doing this and to reduce the resource tax of my system. Any help is greatly appreciated. Thank you!