ssquire
Posts: 0
Joined: Tue Feb 12, 2013 4:36 am

clearRect not working on .apk export

The clearRect command that I use to clear the canvas before I draw the next pitch count number seems to work in the browser when I test, but not when I create & install the .apk file (see shared Baseball_Tools_Pro project with Appery.io Support). I am using the following code to perform the clear and redraw canvas operation:

function drawPitchCountNumber(pCtr) {

var canvas = document.getElementById("pitchCountCanvas");

if (canvas.getContext) {
var ctx = canvas.getContext("2d");

Code: Select all

 // Clear the previously drawn image 
 ctx.clearRect( 0 , 0 , 250 , 100 ); 

//Draw the new image
ctx.fillStyle = "white";
ctx.font="bold 70px Arial";
ctx.fillText(pCtr,110,50);

}
}

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

clearRect not working on .apk export

Hello! Your shared app works for us. Could you please send us screenshot? Also clarify what device/version you use to test?

ssquire
Posts: 0
Joined: Tue Feb 12, 2013 4:36 am

clearRect not working on .apk export

I'm using a Samsung Galaxy Note 3 running Android 4.1.2.

Something else I noticed, if the phone display gets a little dark just before the display shuts offs and I put my finger on the display - so that it lights up again it refreshes the screen and the pitch count appears correctly (i.e. not as shown in my attached graphic).

.jpg?1375210050]Image

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

clearRect not working on .apk export

Instead of clearRect you can use color filling:

codectx.fillStyle = "black&quot
ctx.fillRect(0, 0, canvas.width, canvas.height);/code

ssquire
Posts: 0
Joined: Tue Feb 12, 2013 4:36 am

clearRect not working on .apk export

That works Alena! Thank you!

Now can you tell me how to set backgrounds on all my screens to black. I'm currently using Swatch A and it is a little more gray than black. If I adjust all to black it will be perfect.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

clearRect not working on .apk export

Hi Steven,

You can create a custom theme in ThemeRoller and upload it into Appery.io.

ssquire
Posts: 0
Joined: Tue Feb 12, 2013 4:36 am

clearRect not working on .apk export

That was down right FUN!

Return to “Issues”