AndroidStudio错误:"无法解析符号常量"

时间:2015-06-09 17:25:01

标签: java android android-studio

我试图向JAVA上的PC上的服务器发送消息。

问题出现在字符串out.println(Constants.MOUSE_LEFT_CLICK);上: AndroidStudio说:

  

无法解析符号常量...

 //Get reference to the TextView acting as mousepad
    mousePad = (TextView)findViewById(R.id.mousePad);

    //capture finger taps and movement on the textview
    mousePad.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {

            if(isConnected && out!=null){
                switch(event.getAction()){
                    case MotionEvent.ACTION_DOWN:
                        //save X and Y positions when user touches the TextView
                        initX =event.getX();
                        initY =event.getY();
                        mouseMoved=false;
                        break;
                    case MotionEvent.ACTION_MOVE:
                        disX = event.getX()- initX; //Mouse movement in x direction
                        disY = event.getY()- initY; //Mouse movement in y direction
                        /*set init to new position so that continuous mouse movement
                        is captured*/
                        initX = event.getX();
                        initY = event.getY();
                        if(disX !=0|| disY !=0){
                            out.println(disX +","+ disY); //send mouse movement to server
                        }
                        mouseMoved=true;
                        break;
                    case MotionEvent.ACTION_UP:
                        //consider a tap only if usr did not move mouse after ACTION_DOWN
                        if(!mouseMoved){
                            out.println(Constants.MOUSE_LEFT_CLICK);
                        }
                }
            }
            return true;
        }
    });
}

0 个答案:

没有答案