Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- imageView.setOnTouchListener(new View.OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- if (event.getAction() == MotionEvent.ACTION_UP) {
- //left button
- if (event.getRawX() < width / 2 && event.getRawY() > height / 2) {
- Toast.makeText(MainActivity.this, "Left", Toast.LENGTH_SHORT).show();
- photos.get(++count);
- }
- //right button
- if (event.getRawX() >= width / 2 && event.getRawY() > height / 2) {
- Toast.makeText(MainActivity.this, "Right", Toast.LENGTH_SHORT).show();
- photos.get(--count);
- }
- }
- return true;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement