Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8608167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:32:23+00:00 2026-06-12T03:32:23+00:00

I am working on an app for Android, which is supposed to get an

  • 0

I am working on an app for Android, which is supposed to get an image from another activity, display it, and then one should be able to zoom in and out on this image using pinch to zoom. I tried to achieve this with the following code, however I get an error on onTouchListener. It says “onTouchListener cannot be resolved to a type”, but I don’t get why. I can’t import it or anything, and I think the syntax is ok. Anyways, do any of you know what the problem is?

public class ImageEditing extends Activity implements onTouchListener {

ImageView selectedImage;
Intent intent;
private float oldDistance = 0f;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.imageediting);

    // Load the selected image      
    selectedImage = (ImageView) findViewById(R.id.selectedImage);
    String imagePath = getIntent().getStringExtra("com.andriesse.henk.path");
    Bitmap bitmap = BitmapFactory.decodeFile(imagePath);
    selectedImage.setImageBitmap(bitmap);

    selectedImage.setOnTouchListener(this);

}

public boolean onTouch(View v, MotionEvent event) {
    if((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_MOVE) {
        if(event.getPointerCount() == 2) {
            float x = event.getX(0) - event.getX(1);
            float y = event.getY(0) - event.getY(1);
            float newDistance = FloatMath.sqrt(x*x+y*y);
            if(newDistance > oldDistance) {
                oldDistance = newDistance;
            } else {
                oldDistance = newDistance;
            }
        }
    }
    return true;
}

}

EDIT:

The issue with onTouchListener is solved, but pinch to zoom doesn’t work. Does anybody have a clue why?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:32:24+00:00Added an answer on June 12, 2026 at 3:32 am
    public class ImageEditing extends Activity implements onTouchListener {
    

    OnTouchListener is a class interface and therefore begins with an uppercase letter.

    public class ImageEditing extends Activity implements OnTouchListener {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on an android app that has a database in which one
I working on an android app which can benefit from device information. Like make,
I'm working on an Android app which has an activity and a widget. This
I'm building an android app which should perform a GET on my site to
I'm working on android app development in which how get profiling information like Data
I am working on an Android app that displays photos which are downloaded from
I'm working on an android app - which requests some data from server and
I have made an android app which working fine. I implemented the Login functionality
I'm working on an Android app in which I would like to use multi-touch.
I have an Android app that I had working a few months ago which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.