Android canvas freezes

I have a javascript application that runs on canvas. It works on android, except that when you drag it across the screen with your finger, the entire web page freezes. Is there any way to stop this?

+5
source share
4 answers

The way you present your question does not show a lot of information.

Web applications have some limitations on getting full Android functionality.

Your state I have a javascript application that runs on canvas . In the first case, it seems that you are using an android canvas in your application.

here's the link

which can help you run html5 canvas in android

+2
source

, MotionEvent.ACTION_DOWN MOVE... . - .

, - , :

:

 protected void onDraw(Canvas canvas) {
  // fills the canvas with black
  canvas.drawColor(Color.BLACK);
  // draw some stuff on it
  backGnd.draw(canvas);  
  basket.draw(canvas);
  for (int i = 0; i < AppleList.size();i++){
      AppleList.get(i).draw(canvas);
  }  
 }

( !);

 @Override
 public boolean onTouchEvent(MotionEvent event) {

 if (!isTouchDisabled){
      if (event.getAction() == MotionEvent.ACTION_DOWN) {

        // add code to pass the action down to the objects
           basket.handleActionDown((int)event.getX(), (int)event.getY());
          }

          if (event.getAction() == MotionEvent.ACTION_MOVE) {
           // the gestures

        // only pass the move events to the objects that were previously touched (so action down entails checking for
        // the location of the touch AND the object.. if they match, you set isTouched to true.

        if (basket.isTouched()) {
            // the basket was picked up and is being dragged
            basket.setX((int)event.getX());
            basket.setY((int)event.getY());

           }
          }

          if (event.getAction() == MotionEvent.ACTION_UP) {
           // Check buttons
              if (btnMoreFruit.isTouched()){
                  btnMoreFruit.handleActionUp((int) event.getX(), (int) event.getY());
                  btnMoreFruit.setTouched(false);
              }
              if (btnLessFruit.isTouched()){
                  btnLessFruit.handleActionUp(this.getContext(), (int)event.getX(), (int)event.getY());
                  btnLessFruit.setTouched(false);
              }

          }
 }
+1

, , , - ( ) . , XY , . , , .

0

Android canvas javascript. , .

http://www.youtube.com/watch?v=yDrPNXnH-rg

0

All Articles