This code for effect on click like ripple. just copy this code and past on click place.

Code

android.graphics.drawable.RippleDrawable ripdr = new android.graphics.drawable.RippleDrawable(new android.content.res.ColorStateList(new int[][]{new int[]{}}, new int[]{ Color.GREEN}), new android.graphics.drawable.ColorDrawable(Color.WHITE), null);
button1.setBackground(ripdr);

Can i use this code for different types of click like textview button and etc.

Yes you can use this code anywhere in onclick listener method.