3

In my application. There's section select block of apartment. In there a A and B block. So i want to choose A or B block from single image. Image is enter image description here

There is what way to do this?

Greed Ruler
  • 169
  • 2
  • 14

2 Answers2

0

Use BitMap concept. Convert full image as bitmap the crop the bitmap based on (x,y) positions.

 Bitmap bitmap=BitmapFactory.decodeResource(getResources(), R.drawable.myimage);

 Bitmap cropbitmap=Bitmap.createBitmap(bitmap, xpoint,ypoint,width, height);
 //default android method createBitmap(Bitmap source, int x, int y, int width, int height)

other simple way use library like this from github

sasikumar
  • 12,540
  • 3
  • 28
  • 48
0

I guess you could use getLocationOnScreen()and hardcode the values you want. If user clicks on certain part of the image it prompts one response, if they click somewhere else it prompts another response. More info here Android: How do I get the x y coordinates within an image / ImageView?

Suhail Purkar
  • 104
  • 14