Create bitmap for full listview with all items (Without getting 32 bit illegalArgumentException)

I want to create bitmap (which in turn will be converted to a .png file) of a full listview inside my app. But when I get the bitmap from a listview child I get a

java.lang.IllegalArgumentException: bitmap size exceeds 32bits

Is it somehow possible to override this behaviour? Or do it in a way such that it doesn't get thrown?

The reason Im asking is that I want to have a picture of this list on my website and taking screenshots would be a very tedious process (There are over 400 items in the list, and there are 6 visible on screen at a time.)

As per request here's the code I'm running to create a bitmap atm:

public static Bitmap getWholeListViewItemsToBitmap() {

ListView listview = getListView();
ListAdapter adapter  = listview.getAdapter(); 
int itemscount       = adapter.getCount();
int allitemsheight   = 0;
List<Bitmap> bmps    = new ArrayList<Bitmap>();

for (int i = 0; i < itemscount; i++) {

    View childView      = adapter.getView(i, null, listview);
    childView.measure(MeasureSpec.makeMeasureSpec(listview.getWidth(), MeasureSpec.EXACTLY), 
            MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));

    childView.layout(0, 0, childView.getMeasuredWidth(), childView.getMeasuredHeight());

Bitmap bigbitmap    = Bitmap.createBitmap(listview.getMeasuredWidth(), allitemsheight, Bitmap.Config.ARGB_8888);
Canvas bigcanvas    = new Canvas(bigbitmap);

Paint paint = new Paint();
int iHeight = 0;

for (int i = 0; i < bmps.size(); i++) {
    Bitmap bmp = bmps.get(i);
    bigcanvas.drawBitmap(bmp, 0, iHeight, paint);


return bigbitmap;

And here's the exception being thrown (Please note that this is all I got, Android Studio isn't working for me and all I could save was half the stack trace)

E/AndroidRuntime(375): FATAL EXCEPTION: main
E/AndroidRuntime(375): java.lang.IllegalArgumentException: bitmap size exceeds 32bits
E/AndroidRuntime(375):  at Method)
E/AndroidRuntime(375):  at
E/AndroidRuntime(375):  at android.view.View.buildDrawingCache(


Pretty sure hardware-accelerated views have 48-bit color, so disabling hardware acceleration on the ListView items should fix the drawing cache. I wouldn't rely on the drawing cache to work in future releases.

Need Your Help

Programmatically-created subviews and viewDidUnload

iphone objective-c ios memory-management

For a view controller, any outlets that you set in Interface Builder must be released

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.