Summary: Ctors | Methods | Inherited Methods | [Expand All]
public class

# Tracker

extends Object

java.lang.Object
↳ | com.google.android.gms.vision.Tracker<T>

## Class Overview

A tracker is used to receive notifications for a detected item over time. Subclasses should override the relevant methods below to implement the logic associated with tracking an item in a particular way. Note that Tracker requires the `Detector` return stable IDs across frames for the same object. As a result, some Detectors (such as `TextRecognizer`) currently do not work well with Tracker, and developers may need to implement their own tracking mechanism.

## Summary

Public Constructors
| Tracker()

Public Methods
void | onDone() Called to indicate that the item associated with the ID previously reported via `onNewItem(int, Object)` has been assumed to be gone forever.
void | onMissing(Detections<T> detections) Called if either the tracked item was not detected at all in a frame, or if the specific item identity associated with the tracker is not present in the current frame.
void | onNewItem(int id, T item) This method is called to initially assert a new item when it is detected.
void | onUpdate(Detections<T> detections, T item) As an item is detected over time, this method is called to give an update for the item in the context of the overall detection.

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()

## Public Constructors

#### public Tracker ()

## Public Methods

#### public void onDone ()

Called to indicate that the item associated with the ID previously reported via `onNewItem(int, Object)` has been assumed to be gone forever.

#### public void onMissing (Detections<T> detections)

Called if either the tracked item was not detected at all in a frame, or if the specific item identity associated with the tracker is not present in the current frame. It's possible that the item may be missed for a few frames, and will reappear later, depending upon the detector settings. `onUpdate(Detector.Detections, T)` would then be called.

##### Parameters

detections | full detection results for the frame and associated frame metadata

#### public void onNewItem (int id, T item)

This method is called to initially assert a new item when it is detected. The ID will remain constant for all calls to `onUpdate(Detector.Detections, T)` until `onDone()` is called.

`onUpdate(Detector.Detections, T)` is always called immediately following this method call, with the same item that was passed into this method.

##### Parameters

id | ID representing the specific detected item
item | detection information for the newly detected item

#### public void onUpdate (Detections<T> detections, T item)

As an item is detected over time, this method is called to give an update for the item in the context of the overall detection. Each item that is received has the same ID as the most recent call of `onNewItem(int, Object)`. That is, it has been determined to be the same tracked item as was initially seen.

##### Parameters

detections | full detection results and associated frame metadata
item | detection information for the tracker's associated item