Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

on touch listener android

imageButton.setOnTouchListener(new OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        if(event.getAction() == MotionEvent.ACTION_UP){

            // Do what you want
            return true;
        }
        return false;
    }
});
Comment

on touch listener android

private View.OnTouchListener handleTouch = new View.OnTouchListener() {

    @Override
    public boolean onTouch(View v, MotionEvent event) {

        int x = (int) event.getX();
        int y = (int) event.getY();

        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                Log.i("TAG", "touched down");
                break;
            case MotionEvent.ACTION_MOVE:
                Log.i("TAG", "moving: (" + x + ", " + y + ")");
                break;
            case MotionEvent.ACTION_UP:
                Log.i("TAG", "touched up");
                break;
        }

        return true;
    }
};
Comment

PREVIOUS NEXT
Code Example
Java :: reading from a text file in java 
Java :: how to get data from combobox in java 
Java :: modal css react 
Java :: arraylist of arraylist 
Java :: java 8 map foreach 
Java :: java srting array to string 
Java :: remove last <br/ from string java 
Java :: set ImageView size programmatically android 
Java :: android switch on change 
Java :: check GPS is on android 
Java :: java remove space at the end of string 
Java :: java int 
Java :: get first entry in set java 
Java :: How to find the next greater permutation of a list of numbers, in Java? 
Java :: on selected item changed listview javafx 
Java :: logical operators in java 
Java :: sum of list java 
Java :: check if a string is empty java 
Java :: isnull java 
Java :: guessing game in java 
Java :: java time difference 
Java :: java mongodb find with multiple conditions 
Java :: java delete column from csv 
Java :: Java How to use Set? 
Java :: java interface attributes 
Java :: Concept of Association in java 
Java :: java convert edittext to double 
Java :: make edittext not editable android 
Java :: array arraylist java 
Java :: how to find palindrome numbers in java 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =