Code example for LinkedBlockingQueue

Methods: offer

0
	@Override 
	public void onSensorChanged(SensorEvent event) {
		switch (event.sensor.getType()) {
			case Sensor.TYPE_ACCELEROMETER: {
				Log.i(TAG, "sensor");
				sharedQueue.offer(new AccelDataPoint(System.currentTimeMillis(), event.values.clone()));
			} 
		} 
	} 
 
	public void triggerAlarm() { 
		Intent intent = new Intent(mContext, AlarmActivity.class);
		intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		getApplication().startActivity(intent);
		stopSelf();
	} 
 
	private class DummyThread extends Thread {
 
		private final String TAG = DummyThread.class.getName();