AI-generated Key Takeaways
-
ActivityTransitionEvent
represents an activity transition event like starting to walk or stopping running, and implementsParcelable
. -
It provides methods to access the activity type, transition type, and elapsed time of the transition.
-
Activity types are defined in
DetectedActivity
, while transition types are defined inActivityTransition
. -
You can create an
ActivityTransitionEvent
using its constructor, providing the activity type, transition type, and elapsed time in nanoseconds. -
The class includes methods for Parcelable implementation and standard object methods like
equals
,hashCode
, andtoString
.
Represents an activity transition event, for example start to walk, stop running etc.
Inherited Constant Summary
Field Summary
public static final Creator<ActivityTransitionEvent> | CREATOR |
Public Constructor Summary
ActivityTransitionEvent(int activityType, int transitionType, long
elapsedRealtimeNanos)
Creates an activity transition event.
|
Public Method Summary
boolean | |
int |
getActivityType()
Gets the type of the activity of this transition.
|
long |
getElapsedRealTimeNanos()
Gets the elapsed realtime when this transition happened.
|
int |
getTransitionType()
Gets the type of the transition.
|
int |
hashCode()
|
String |
toString()
|
void |
writeToParcel(Parcel dest, int
flags)
|
Inherited Method Summary
Fields
public static final Creator<ActivityTransitionEvent> CREATOR
Public Constructors
public ActivityTransitionEvent (int activityType, int transitionType, long elapsedRealtimeNanos)
Creates an activity transition event.
Parameters
activityType | the type of the activity of this transition |
---|---|
transitionType | the type of transition |
elapsedRealtimeNanos | the elapsed realtime when this transition happened |
Public Methods
public boolean equals (Object object)
public int getActivityType ()
Gets the type of the activity of this transition. It's one of activity types defined
in DetectedActivity
.
public long getElapsedRealTimeNanos ()
Gets the elapsed realtime when this transition happened. Note that the event may happen in the past which means this timestamp may be much smaller than the current time.
public int getTransitionType ()
Gets the type of the transition. It's one of the transition types defined in
ActivityTransition
.