<Spinner
android:entries="@array/ChoicesFromFile" />
<ImageView
android:src="@drawable/ImageFile" />
int numericalId = R.id.myId;
<Button
android:text="New Button"
android:id="@+id/button"
android:onClick="aMethod"/>
Button myButton = (Button) getViewById('myButtonId');
myButton.setOnClickListener(new MyListenerObject());
class MyListenerObject implements OnClickListener{
public void onClick(View v) {
\\Respond to event
}
}
mySensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
To attach the listener, an object representing the sensor must be retrieved from the sensor manager object
temp = mSensorManager.getDefaultSensor(Sensor.TYPE_TEMPERATURE);
The listener is then attached using registerListener and passing the listener, the sensor, and the delay between sensor events
mySensorManager.registerListener(new SensorEventListener(), temperature, SensorManager.SENSOR_DELAY_NORMAL);