示例#1
0
 /**
  * @see
  *     android.widget.AdapterView.OnItemSelectedListener#onItemSelected(android.widget.AdapterView,
  *     android.view.View, int, long)
  */
 @Override
 public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
   Log.d(TAG, "onItemSelected " + _vrpnAnalogId + " position" + position);
   // Send the vrpn update
   // Note : The line below throws an exception in the Eclipse GUI preview
   VrpnClient.getInstance().sendAnalog(_vrpnAnalogId, position);
 }
示例#2
0
  private void init(AttributeSet attrs) {
    // Get the custom attribute values
    TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.VrpnSpinner);
    _vrpnAnalogId = a.getInt(R.styleable.VrpnSpinner_vrpnAnalog, 0);
    a.recycle();

    setOnItemSelectedListener(this);
    setSelection(0);

    // Trigger a Vrpn update to get a known initial state
    Log.d(TAG, "ctor " + _vrpnAnalogId + " position " + 0);
    VrpnClient.getInstance().sendAnalog(_vrpnAnalogId, 0);
  }
示例#3
0
 @Override
 public void onCreate() {
   _vrpnClient = VrpnClient.getInstance();
   _vrpnClient.init(getApplicationContext());
 }