I have a layout with images and I want that when I tap on each of them they show a specific message on the screen. my problem is that when I am tapping on any imageview in the layout I am getting only the message I set for the first one. Here is my code can you tell me what the problem is: earlir I tried this code in the method on singletap: int id=0 case 0:id=R.id.imageView1 but this doesnot work as well please help
gestureDetector = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() {
public boolean onSingleTapConfirmed(MotionEvent e){
Toast.makeText(Creaacount_5.this, "single tap", Toast.LENGTH_SHORT).show();
EditText b=(EditText)findViewById(R.id.editText1);
b.append("*");
int id=0;
ImageView i=(ImageView) findViewById(R.id.imageView1);
id=i.getId();
int id1;
ImageView b1=(ImageView) findViewById(R.id.imageView2);
id1=b1.getId();
int id2;
ImageView c=(ImageView) findViewById(R.id.imageView2);
id2=c.getId();
int v=i.getId();
if(id==R.id.imageView1){
EditText t1 = (EditText)findViewById(R.id.editText1);
id=R.drawable.playing;
SpannableString ss = new SpannableString("abc");
ImageView r=(ImageView) findViewById(R.id.imageView1);
Drawable d = r.getDrawable();
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
ImageSpan span = new ImageSpan(d, ImageSpan.ALIGN_BASELINE);
ss.setSpan(span, 0, 3, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
t1.append(ss);
id=R.drawable.playing;
Toast.makeText(Creaacount_5.this,"play",Toast.LENGTH_SHORT).show();
SharedPreferences s1=getSharedPreferences(MyPreferences,MODE_PRIVATE);
SharedPreferences.Editor editor1=s1.edit();
editor1.putInt("play", R.drawable.playing);
}