Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27524] Android: imageView toBlob() method returns null.

GitHub Issuen/a
TypeBug
PriorityNone
StatusResolved
ResolutionWon't Do
Resolution Date2019-11-05T17:40:49.000+0000
Affected Version/sRelease 8.2.1
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterMotiur Rahman
AssigneeAlan Hutton
Created2019-11-04T16:10:00.000+0000
Updated2019-12-02T23:06:34.000+0000

Description

*Issue:* imageview toBlob() method returns null but it should return as a blob object. It returns a proper value in iOS Steps to Reproduce 1. Run the following sample code on an emulator or a device 2. Then check the console log.
var win = Titanium.UI.createWindow({
		className : 'win'
	});

	var img = Ti.UI.createImageView({
		image : 'http://ursinus.prestosports.com/sports/wbkb/2019-20/photos/KRR_48190-1.jpg?max_width=160&max_height=120',
		top : 40,
		width : 200,
		height : 200
	});

	win.add(img);

	Ti.API.info("ImgeView:", img.toBlob());

 win.open();

WARN] :   TiDrawableReference: (main) [137661,138015] Could not open stream to get bitmap
[INFO] :   ImgeView: null
[INFO] :   Choreographer: Skipped 1797 frames!  The application may be doing too much work on its main thread.
[INFO] :   APSAnalyticsStore: session.end
[INFO] :   APSAnalyticsService: Successfully sent 1 stored event(s)

Comments

  1. Joshua Quick 2019-11-04

    You can't take a screenshot of the ImageView via toBlob() until it's been displayed on-screen. This means you have to wait for the window to open.
       win.addEventListener("open", function() {
       	Ti.API.info("ImageView:", img.toBlob());
       });
       
  2. Alan Hutton 2019-11-05

    Closing per support comments.

JSON Source