Android SDK 4.4.2 Titanium 3.4.1 GA
Platform Android 4.4.2 Kindle Fire and Samsung Tab4
I have an app that uses PaintView to allow the user to draw/erase notes - this works fine on IOS using toImage() to capture the image which i write to a file. when the user comes back to their drawing the image is loaded back into the PaintView. On android you have to use toImage().media to do the same thing.
So the key statements are;
myBLOB = viewObject.toImage().media; var imageDir = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory); var imageFile = Ti.Filesystem.getFile(imageDir.resolve(), 'notes.jpg'); imageFile.write(myBLOB);then when the view is created I do;
notesView = Paint.createPaintView({ top:0, left:0, width:"100%", strokeColor:notesColour, strokeAlpha:180, strokeWidth:3, eraseMode:false,zindex:1,paintType:"notes",touchEnabled:false,visible:false, image:Ti.Filesystem.applicationDataDirectory+"notes.jpg" });the first time round an empty notes.jpg file is available and the PaintView is created normally. Once a new version has been written I get;
[ERROR] : TiApplication: (main) [372,6300] Sending event: exception on thread: main msg:java.lang.IllegalStateException: Immutable bitmap passed to Canvas constructor; Titanium 3.4.1,2014/11/13 13:33,5982e8f [ERROR] : TiApplication: java.lang.IllegalStateException: Immutable bitmap passed to Canvas constructor
Any suggestions gratefully received!