0

I am trying to implement a small application with canvas on surface view and added some Bmp images on that canvas as shown in attached image.

Click here to check the requirement in image

Here A,B,C,D,E and Bmp1 are bitmaps and all can move. Below is my requirements:

  1. I want to drag bitmap on another bitmap like i want to drag bmpA from left to right over Bmp1(Now if i am trying to do like that they are merging).

  2. I want to know where i have touched on the screen like i touched on Bmp1 or touched on A or B or C.... or empty canvas area.(Now i can recognize whether i have touched Bmp1 or other by using below code.

    if (mTouched_x >= Bibox.getCurrentPosition().x && mTouched_x < (Bibox.getCurrentPosition().x + BBoxBmp.getWidth()) && mTouched_y >= Bibox.getCurrentPosition().y && mTouched_y < (Bibox.getCurrentPosition().y + BBoxBmp.getHeight()))
        return true;
    else
        return false;
    

But I want to know whether I have touched other Bmp's or not because A,B,C.. are dynamic bmp's and number may increase.

BiBox
  • 47
  • 10
  • and what have you done so far? – pskink May 07 '15 at 07:27
  • i so far created a class **CustomSurfaceView** extends _SurfaceView implements Runnable, OnDragListener_. Here i created a class to maintain properties of those bitmaps. And i am first time working on **Canvas** i am not getting any hint to implement those – BiBox May 07 '15 at 07:34
  • why OnDragListener? you are drawing your Bitmaps in SurfaceView, so do the drag by yourself – pskink May 07 '15 at 07:36
  • Yes i want to drag Bitmaps and i need to create one connection between those if those are in close. – BiBox May 07 '15 at 07:39
  • see here http://stackoverflow.com/a/21657145/2252830, on how i did similar thing – pskink May 07 '15 at 07:40
  • @pskink : Thankyou for your response. You created those by extending **View** and you are used some _layout_ (If my guess is correct).But i retirement is use **SurfaceView and Canvas** – BiBox May 07 '15 at 07:47
  • there is no big difference: both use Canvas – pskink May 07 '15 at 07:49
  • and i checked your example. My requirement and your suggestion both are not matching :( – BiBox May 07 '15 at 07:52
  • well points 1) and 2) are met... – pskink May 07 '15 at 07:53
  • @pskink sorry to say your application is not working in my Mot G2 mobile – BiBox May 07 '15 at 09:07
  • not working?   ׂׂׂׂׂ – pskink May 07 '15 at 09:13
  • Possible duplicate of [Android ImageView Scaling and translating issue](http://stackoverflow.com/questions/21633545/android-imageview-scaling-and-translating-issue) –  Apr 19 '16 at 18:14

0 Answers0