Hi, im trying to learn with my first app, and i have 2 problem
1) i have to click 2 times on the image for change it
2) the imageview clicked its selected even if i click in other sector of the screen
thanks
public void onClick(final View imageView) { final ImageView mypic1 = (ImageView) findViewById(R.id.select1); ImageView mypic2 = (ImageView) findViewById(R.id.select2); ImageView mypic3 = (ImageView) findViewById(R.id.select3); ImageView mypic4 = (ImageView) findViewById(R.id.select4); ImageView mypic5 = (ImageView) findViewById(R.id.select5); ImageView mypic6 = (ImageView) findViewById(R.id.select6); View.OnClickListener listener= new OnClickListener() { public void onClick(View v) { int profileold = R.drawable.image; int profilenew = R.drawable.image_selected; if(imageView instanceof ImageView ){ if(savedImageRef == seleccion){ ((ImageView) imageView).setImageResource(R.drawable.image); savedImageRef = profileold; }else{ ((ImageView) imageView).setImageResource(R.drawable.image_selected); savedImageRef = profilenew; } } }}; mypic1.setOnClickListener(listener); mypic2.setOnClickListener(listener); mypic3.setOnClickListener(listener); mypic4.setOnClickListener(listener); mypic5.setOnClickListener(listener); mypic6.setOnClickListener(listener); }