how to solve onTouchListener android <p>i have problem, I am successfully to display image in alert dialog custom, but when I want to add event <code>onTouchListener</code> to the image, i cannot get problem : <code>the method setonTouchListener in Type View is not applicable</code>. Here my source code :</p> <pre><code>public class ViewDetailItem extends Activity implements OnTouchListener{ bla bla... onloaditem() } </code></pre> <p>here onloaditem() sourcecode :</p> <pre><code> imgmain.setImageResource(imgID); imgmain.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub /*Intent MyIntentDetailItem=new Intent(getBaseContext(), ViewDetailItemFullscreen.class); Other_class.setItemCode(timgName); startActivity(MyIntentDetailItem);*/ LayoutInflater li = LayoutInflater.from(ViewDetailItem.this); final View inputdialogcustom = li.inflate(R.layout.activity_view_detail_item_fullscreen2, null); final AlertDialog.Builder alert = new AlertDialog.Builder(ViewDetailItem.this); final ImageView imgmainbig=((ImageView) inputdialogcustom.findViewById(R.id.imgmainbig)); imgID=getBaseContext().getResources().getIdentifier(imgName2+"_1", "drawable", getBaseContext().getPackageName()); imgmainbig.setImageResource(imgID); imgmainbig.setOnTouchListener(this); } } </code></pre> <p>The problem refers to <code>imgmainbig.setOnTouchListener(this);</code></p>