Need help to draw buttons around the circular path in Java code?

advertisements

i can get a central point of the circular,so i want to draw some buttons around the central point of the circular,as you seen in this image http://i.6.cn/cvbnm/50/97/b0/e7ed11251c3069fea4130c74b3ecb10c.png ,can you give me some advice,Links to examples will be more useful. This is My code

Edit:

public class drawCirPicture extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(new SampleView(this));
}

private static class SampleView extends View {
    private Bitmap mBitmap;

    public SampleView(Context context) {
        super(context);
        setFocusable(true);

        InputStream is = context.getResources().openRawResource(android.R.drawable.sym_call_outgoing);
        mBitmap = BitmapFactory.decodeStream(is);

    }

    @Override protected void onDraw(Canvas canvas) {
        canvas.drawColor(Color.GRAY);

        Paint p = new Paint();
        float centerY = 200;
        float centerX=130;

       double alpha = 0,wedge=0;
       double PI=Math.PI;

        float x,y;

        int radius=55;

        for (alpha = 0, wedge = 2 * PI / 4; alpha < 2 * PI; alpha += wedge)
        {
            x = (float) (centerX + radius * Math.cos(alpha));
            y = (float) (centerY + radius * Math.sin(alpha));
            canvas.drawBitmap(mBitmap, x, y, p);
        }

    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        // TODO Auto-generated method stub
        return super.onTouchEvent(event);
    }

    @Override
    public boolean performClick() {
        // TODO Auto-generated method stub
        return super.performClick();
    }
    }
}

i am able to put images in the circular path, but i was not able to implement ontouch event or onclick event of every image, and also the centerX or centerY locate the edge of the screen ,how to put the images to the wide area of the screen.


x = centerX + radius * cos(alpha)
y = centerY + radius * sin(alpha)

Where alpha is between 0 and 2 * PI.

Trigonometry is cool.