/** * @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); }
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); }
@Override public void onCreate() { _vrpnClient = VrpnClient.getInstance(); _vrpnClient.init(getApplicationContext()); }