how to import button in android studio? code example

Example 1: android studio button usage

//this for xml file 

Example 2: show button selected when clicked

mycodes_Button.setOnTouchListener(new OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        mycodes_Button.setPressed(true);
        return true;
    }
});

Tags:

Misc Example