user2386771
user2386771

Reputation: 177

canvas.todataurl() not working in android 2.3.3

I am drawing an 3 images on canvas and saving base64 to database, and retriving that value and displaying it in my page.

canvas.todataurl() works in my android 4.2.2 version

But when i tried to work on 2.3.3 instead of image i am getting just a question mark.

var canvasimage = document.getElementById('ImageDisplay');
     var context = canvasimage.getContext('2d');
   Image = canvas.toDataUrl();

How to solve this?

Thanks:)

Upvotes: 2

Views: 774

Answers (1)

VixinG
VixinG

Reputation: 1407

It should be done this way:

Working sample

var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d");
var img = new Image();
img.src = canvas.toDataURL();
context.drawImage(img, X, Y); //draws canvas image in X, Y

http://jsfiddle.net/vixing/mHd4b/ <-- example

Upvotes: 1

Related Questions