Code example for BlockingQueue

Methods: clear, size

0
	} 
	 
	/* "startStream", "(J)I" */ 
	public int startStream(/*long minTime*/) { 
		Log.w(TAG, "Starting GPS stream");
		locQueue.clear();
		 
		Log.w(TAG, "queue cleared");
		 
		handlerThread = new HandlerThread("ZeGPSCallbacks");
		Log.i(TAG, "Created "+handlerThread.getName());
		 
		try { 
			handlerThread.start();
		} catch (Exception e) { 
			e.printStackTrace();
			return 0; 
		} 
		 
		Log.w(TAG, "handler thread running");
		 
		try { 
			locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
				0, 0, locationListener, handlerThread.getLooper());
			Log.w(TAG, "location updates requested");
		} catch (Exception e) { 
			e.printStackTrace();
			return 0; 
		} 
		 
		isStreaming = true;
		return 1; 
	} 
	 
	 
	/* "stopStream", "()I" */ 
	public int stopStream() { 
		Log.w(TAG, "Stopping GPS stream");
		Log.w(TAG, "There are "+Integer.toString(locQueue.size())+" elements left in the queue");
		locationManager.removeUpdates(locationListener);
		try { 
		handlerThread.quit();
		handlerThread.interrupt();
		} catch (Exception e) { 
			e.printStackTrace();
			return 0; 
		} 
		isStreaming = false;
		locQueue.clear();
		return 1; 
	} 
	 
	/* "changeFrequency", "(J)I" */ 
	public int changeFrequency(/*long minTime*/) {