0

I have Made a Rotating Wheel Menu By Reading this Tutorial. http://developer.digitalaria.com/devguide/gama/en/gama/wheel_android.php

enter image description here

It is Working.But I Don't Know how to add Onclick method to this Wheel Menu.

**Activity **

public class SampleWheelActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        init();
    }

    private Wheel wheel;
    private Resources res; 
    private int[] icons = { 
            R.drawable.icon00, R.drawable.icon01, R.drawable.icon02, 
            R.drawable.icon03, R.drawable.icon04, R.drawable.icon05, 
            R.drawable.icon06, R.drawable.icon07, R.drawable.icon08, 
            R.drawable.icon09, R.drawable.icon10, R.drawable.icon11 };

    private void init() {
        res = getApplicationContext().getResources();
        wheel = (Wheel) findViewById(R.id.wheel);

        wheel.setItems(getDrawableFromData(icons));
        wheel.setWheelDiameter(400);
    }

    private Drawable[] getDrawableFromData(int[] data) {
        Drawable[] ret = new Drawable[data.length];
        for (int i = 0; i < data.length; i++) {
            ret[i] = res.getDrawable(data[i]);
        }
        return ret;
    }

}
Machavity
  • 30,841
  • 27
  • 92
  • 100
AruLNadhaN
  • 2,808
  • 5
  • 24
  • 42
  • 1
    as mention in its docs use this method to register the click event setOnItemClickListener and this callback method to handle the click event getOnItemClickListener – mohammed momn Feb 16 '14 at 04:40

1 Answers1

0

I've never used their API but they do provide documentation:

http://developer.digitalaria.com/reference/en/gama/android/

wheel.setOnItemClickListener(new WheelAdapter.OnItemClickListener() {
    @Override
    public void onItemClick(WheelAdapter<?> parent, View view, int position, long id) {
       // add your code here...
    }
});
singularhum
  • 5,072
  • 2
  • 24
  • 32