I’ve two ImageButtons in my layout, “plus” and “minus”.
I attach a click listener to the “plus” button with a simple toast message in the click function, and it works.
ImageButton btplus = (ImageButton)findViewById(R.id.btplus);
btplus.setOnClickListener( new ImageButton.OnClickListener(){
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(), "+", Toast.LENGTH_SHORT);
}
});
Then i attach a second click listener to the minus ImageButton…
ImageButton btminus = (ImageButton)findViewById(R.id.btminus);
btminus.setOnClickListener( new ImageButton.OnClickListener(){
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(), "-", Toast.LENGTH_SHORT);
}
});
…and no more button click works! The “plus” click too stop working.
I’ve seen a lot of examples on this theme, but i can’t see any difference between them (working) and mine.
1 Answer