Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fetch the clicked area of image in Android

I am working on a Quiz app and have made it working for normal questions that will be shown in my TextView. Further I require to show user an Image (probably find the difference between two images OR find letters hidden in image) and for that, user have to click on some area of the image.

How can I get the point where the user has clicked on the Image.

like image 580
Kanagalingam Avatar asked Jan 25 '26 05:01

Kanagalingam


1 Answers

bool imagesAreEqual(Image i1, Image i2)
{
    if (i1.getHeight() != i2.getHeight()) return false;
    if (i1.getWidth() != i2.getWidth()) return false;

    for (int y = 0; y < i1.getHeight(); ++y)
       for (int x = 0; x < i1.getWidth(); ++x)
            if (i1.getPixel(x, y) != i2.getPixel(x, y)) return false;

    return true;
}

It compares each and every pixels and returns a boolean value whether they are equal.

Refer the below thread, compare two images in android

like image 179
TrekFety Avatar answered Jan 27 '26 18:01

TrekFety



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!