Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Use BinaryDrawable to Bundle Images into Android JAR Files

DZone's Guide to

Use BinaryDrawable to Bundle Images into Android JAR Files

· Java Zone
Free Resource

Build vs Buy a Data Quality Solution: Which is Best for You? Gain insights on a hybrid approach. Download white paper now!

Android developers interested in including images in their JAR files - at least those making limited use of images and hoping to avoid the trouble of a res folder or Android library project - might find BinaryDrawable, a new tool from Hipmob, to be useful. According to Hipmob, it works like this:

To convert any image that can be understood by the Android platform's built-in BitmapFactory into a BinaryDrawable instance we simply read the image file and create a Java source file that includes a byte array with the image data. The generated class can then use decodeByteArray to get a Bitmap, and then it is a short hop to a BitmapDrawable.

Be aware, though, that there are some serious limitations to this tool: only very small images will work (under about 10kb), and JPG and PNG are the only acceptable formats. So, BinaryDrawable isn't for everybody, but if you only need small images here and there - icons seem like the most likely use - it could be worth checking out.

Build vs Buy a Data Quality Solution: Which is Best for You? Maintaining high quality data is essential for operational efficiency, meaningful analytics and good long-term customer relationships. But, when dealing with multiple sources of data, data quality becomes complex, so you need to know when you should build a custom data quality tools effort over canned solutions. Download our whitepaper for more insights into a hybrid approach.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}