Q:

Android: Create many buttons in an image

i have an image and i want to create clickable parts. 
I have thought to make several transparent button but I'm not sure they are aligned in different screen resolution.
How can I do this?
Thanks

A:

A good way to do it is to use OnTouchListener instead of OnClickListener:
here is a sample code for that:
    ImageView myView = (ImageView) findViewById(R.id.image_view);
    myView.setOnTouchListener(new OnTouchListener(){

        @Override
        public boolean onTouch(View view, MotionEvent event) {
            // TODO Auto-generated method stub
            if (event.getAction() == MotionEvent.ACTION_DOWN) {
                float x = event.getX();
                float y = event.getY();
                float xRef = view.getX();
                float yRef = view.getY();
                // calcualte position inside view
                x = x - xRef;
                y = y - yRef;
                //decode (x, y) to parts

                return true;
            }
            return false;
        }

    });

