Any view can be customized using onClickListener()
, which is part of the view class. The easiest way to do this is to set up links to your view in the onCreate()
method. Here is an example image:
ImageView iv = (ImageView) findViewByID(R.id.example); iv.setOnClickListener(new View.OnClickListener() { public void onClick(View v) {
UPDATE: DOUBLE TAP
Here is an example of an activity that implements basic double-touch detection in an image view:
import android.app.Activity; import android.os.Bundle; import android.os.SystemClock; import android.view.MotionEvent; import android.view.View; import android.widget.ImageView; import android.widget.Toast; public class DoubleTapActivity extends Activity {
source share