I have an ImageView inside a ScrollView. The ImageView is clickable and opens up a new Activity.
Whenever I scroll through my ScrollView first touching the image (But not releasing my finger yet) and try to scroll it fires my onTouch() or onClick() method (I have tried with both…)
Here is my code:
btnAdd.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Intent intent = new Intent(Intent.ACTION_EDIT);
startActivity(intent);
return true;
}
});
As I said I also tried with onClick()…
What am I doing wrong?
When the OnTouchListener is triggered it listen for multiple actions (Action Down, Action Up, etc) and executes them all so you should specify exactly when you want to start the new activity (in your case on Action Up). So try to use this: