0

I am trying to use the following code in my Class:

      final ImageView imageView = (ImageView) findViewById(R.id.imageView2);
      imageView.setOnTouchListener(new OnSwipeTouchListener(context) {
      @Override
      public void onSwipeLeft() {
        Intent intent2 = new Intent(GalleryView.this, GalleryView2.class);
        startActivity(intent2);
        finish();
            }
        });

   }    

and it gives me the error:

context cannot be resolved to a variable

What does it mean? I have searched all afternoon, and can't find an answer. What should it be instead of context?

Thanks very much.

I got the code from:

Android: How to handle right to left swipe gestures

and used the code from Edward Brey. Unfortunately I don't have enough points to ask Edward Brey directly.

Thanks in advance.

Community
  • 1
  • 1
user3079872
  • 191
  • 1
  • 5
  • 15
  • 1
    change "context" TO "this" or "your_activity.this"... – Ranjit Jun 09 '14 at 16:41
  • @MLProgrammer-CiM, I haven't tried your suggestion. Ranjit's one was much easier to implement and what I want to do works. My programming is probably a bit noddy, but it does what is supposed to do ... Thanks for taking the time though, very grateful. – user3079872 Jun 09 '14 at 19:41

0 Answers0