@Override
 public boolean onTouchEvent(MotionEvent event) {
    ......
  switch(keyAction) {
   case MotionEvent.ACTION_MOVE :
    if(bMove) {
         ......
     if(choice != 10) {
      int goX = (int) ((moveX/10)*scale);
      int goY = (int) ((moveY/10)*scale);
            
      switch(choice) {
      case 0:
       if(moveX>moveY) {
        padTable[choice].getPlace().x += goX;
        padTable[choice].getPlace().y += goY;
       }
       
       else {
        padTable[choice].getPlace().x += goX;
        padTable[choice].getPlace().y += goY;
       }
       
       break;
       
      case 1:
       padTable[choice].getPlace().y += goY;
       break;
      ......
      }
     } 
    }
     
    break;
    
   case MotionEvent.ACTION_UP :
    if(!(padTable[choice].getPlace().x >70 && padTable[choice].getPlace().x <140)
      ||!(padTable[choice].getPlace().y >70 && padTable[choice].getPlace().y <140)) {
    
     init();
      
     bChoose = false;
     choice = 10;
     mouseX = mouseY =0;
     moveX = moveY = distance =0;
    }
    
    bMove = false;
    
    break;
    
   case MotionEvent.ACTION_DOWN :
    bMove = true;
    mouseX = event.getX();
    mouseY = event.getY();
    
    //queue[qIndex].set((int)mouseX, (int)mouseY);
    qIndex++;
    break;
  }
  return true;
 }
 
////////////////////////////////////////////////////////////////////
//// Drawing Thread Inner Class //////////////////////////////////// 
class DrawThread extends Thread {
  boolean bExit;
  SurfaceHolder holder;
  
  DrawThread(SurfaceHolder Holder) {
   holder = Holder; 
   bExit = false;
  }
  
  @Override
  public void run() {
   while(!Thread.currentThread().isInterrupted()) {
    Canvas c = null;
    
    try {
     c = holder.lockCanvas(null);
     synchronized(holder) {
      doDraw(c);
      Thread.sleep(50);
     }
    } catch(InterruptedException e) {
     e.printStackTrace();
    } finally {
     if(c != null) {
      holder.unlockCanvasAndPost(c);
     }
    }
   }
  }

  private void doDraw(Canvas cv) {
   Paint paint = new Paint();
   paint.setAntiAlias(true);
   
   cv.drawColor(Color.BLACK);
   cv.drawBitmap(padTable[0].getPadImg(), padTable[0].getPlace().x, padTable[0].getPlace().y, null);
   cv.drawBitmap(padTable[1].getPadImg(), padTable[1].getPlace().x, padTable[1].getPlace().y, null);
   cv.drawBitmap(padTable[2].getPadImg(), padTable[2].getPlace().x, padTable[2].getPlace().y, null);
   cv.drawBitmap(padTable[3].getPadImg(), padTable[3].getPlace().x, padTable[3].getPlace().y, null);
   cv.drawBitmap(padTable[4].getPadImg(), padTable[4].getPlace().x, padTable[4].getPlace().y, null);
   cv.drawBitmap(padTable[5].getPadImg(), padTable[5].getPlace().x, padTable[5].getPlace().y, null);
   cv.drawBitmap(padTable[6].getPadImg(), padTable[6].getPlace().x, padTable[6].getPlace().y, null);
   cv.drawBitmap(padTable[7].getPadImg(), padTable[7].getPlace().x, padTable[7].getPlace().y, null);
   cv.drawBitmap(padTable[8].getPadImg(), padTable[8].getPlace().x, padTable[8].getPlace().y, null);
   
   if(choice == 10) return;
   
   paint.setTextSize(16);
   paint.setColor(Color.WHITE);
   cv.drawText("Move Enable : "+bMove, 0, 400, paint);
   cv.drawText("Choice : "+choice, 0, 425, paint);
   cv.drawText("img["+choice+"] placed : X="+padTable[choice].getPlace().x+", Y="+padTable[choice].getPlace().y, 0, 450, paint);
   cv.drawText("Mouse Point : X="+mouseX+", Y="+mouseY, 0, 500, paint);
   cv.drawText("moveX : "+moveX+", moveY="+moveY, 0, 525, paint);
   cv.drawText("slope : "+slope, 0, 550, paint);
   
   if(padTable[choice].getPlace().x >100 &&  padTable[choice].getPlace().x <170)
    if(padTable[choice].getPlace().y >100 && padTable[choice].getPlace().y <170) {
     paint.setColor(Color.RED);
     cv.drawRect(200, 200, 100, 100, paint);
     
     if(padTable[choice].getNextFlag() == 'A') {
      padTable[choice].setNextPhase();
      changeBitmap("11", choice);
      init();
     }
     
     else {
      padTable[choice].setPrevPhase();
      changeBitmap("first", choice);
      init();
     }
     
     bChoose = false;
     choice = 10;
     moveX = moveY = 0;
    }
  }
 } 
//// ↑↑↑ Inner Class ↑↑↑ /////////////////////////////////////
///////////////////////////////////////////////////////////////
}

  

 

줄인다고 줄였는데 여전히 기네요;;

 

아래는 에러로그입니다.

 

10-26 13:34:41.832: ERROR/AndroidRuntime(5520): FATAL EXCEPTION: Thread-10
10-26 13:34:41.832: ERROR/AndroidRuntime(5520): java.lang.NullPointerException
10-26 13:34:41.832: ERROR/AndroidRuntime(5520):     at android.graphics.Canvas.throwIfRecycled(Canvas.java:954)
10-26 13:34:41.832: ERROR/AndroidRuntime(5520):     at android.graphics.Canvas.drawBitmap(Canvas.java:980)
10-26 13:34:41.832: ERROR/AndroidRuntime(5520):     at edu.esrc.thirdPad.AnEventMove$DrawThread.doDraw(AnEventMove.java:424)
10-26 13:34:41.832: ERROR/AndroidRuntime(5520):     at edu.esrc.thirdPad.AnEventMove$DrawThread.run(AnEventMove.java:402)
10-26 13:41:57.265: ERROR/TalkProvider(237): replaceContactWithContactId: contactId==0!!! smile.heegon@gmail.com, acct=1
10-26 13:41:57.277: ERROR/TalkProvider(237): insert presence failed for account=1 username=smile.heegon@gmail.com client_type=2 status=미소 cap=15 priority=0 mode=5

 

실행시키면 ACTION_DOWN부터  ACTION_MOVE까지는 문제 없이 되는데

 

ACTION_UP이 발생하거나 MOVE의 도착점에 걸리면 계속 드로잉 쓰레드에서 이셉션이 발생하는 것 처럼 보입니다.

 

어느부분을 잘못 건드리게 되는건지 모르겠습니다. 도와주세요...