There is an application where you need to draw four lines. But while drawing, the FPS gradually decreases. Here is the code:

switch (me.getAction()) { case MotionEvent.ACTION_DOWN: leadonepath.moveTo(me.getX(), me.getY()); leadtwopath.moveTo(me.getX() + 5, me.getY()); leadthreepath.moveTo(me.getX() + 10, me.getY()); leadfourpath.moveTo(me.getX() + 15, me.getY()); startX = me.getX(); startY = me.getY(); break; case MotionEvent.ACTION_MOVE: fX = (int)me.getRawX(); fY = (int)me.getRawY(); if(fX == prevFX || fY == prevFY)break; prevFX = fX; prevFY = fY; calculatPosition(); if (mScratchStart){ leadonepath.lineTo(fX, fY); leadtwopath.lineTo(fX + 5, fY); leadthreepath.lineTo(fX + 10, fY); leadfourpath.lineTo(fX + 15, fY); } else { if (isScratch(startX, me.getX(), startY, me.getY())) { mScratchStart = true; leadonepath.lineTo(fX, fY); leadtwopath.lineTo(fX + 5, fY); leadthreepath.lineTo(fX + 10, fY); leadfourpath.lineTo(fX + 15, fY); allowdrawleads = false; } } } else { ... } scores += scoreInc; h.post(updateScores); if(!allowdrawleads) h.post(updateCanvas); break ; case MotionEvent.ACTION_UP: mScratchStart = false; try { ... } catch (Exception ex) {} break; } 
  • I apologize for the incorrect spelling of the question, because I'm writing from the tablet. - Helisia
  • Probably, inside called methods, there are complex calculations. - KoVadim
  • No, there are no complicated calculations - Helisia
  • 2
    Unfortunately, my telepathic abilities do not allow me to look inside these methods. Maybe there just goes fps output through formatting the string. - KoVadim
  • If you need onDraw content, I can put it here - Helisia

0