[TIMOB-16245] Android: Ti.UI.ImageView.toImage() returns KrollDict object instead of Blob object
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Low |
| Status | Open |
| Resolution | Unresolved |
| Affected Version/s | Release 3.2.0 |
| Fix Version/s | n/a |
| Components | Android |
| Labels | n/a |
| Reporter | grebulon |
| Assignee | Unknown |
| Created | 2014-01-19T10:46:51.000+0000 |
| Updated | 2019-10-27T20:50:54.000+0000 |
Description
ImageView.toImage() is supposed to return a TiBlob according to the doc, but it returns a KrollDict, where the blob is in the media key.
This is implemented in the TiUIView superclass, which calls TiUIHelper.viewToImage. TiUIImageView should override toImage and return a TiBlob, or you can just change the documentation...
Moving this ticket to engineering as I verified that Ti.UI.ImageView does not implement toImage method but inherits it.
In a native module I tried:
How can I use aKrollDict imageBlob = TiUIHelper.viewToImage(proxy.getProperties(), myScrollView.getOuterView()); Object data = imageBlob.get("media"); byte[] byteArray = (byte[])data; // this creashes (cannot cast blob to byte array) Bitmap bitmap = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);toImage()for BitmapFactory?