UnderstandResult.Builder


public static final class UnderstandResult.Builder
extends Object

java.lang.Object
   ↳ android.service.personalcontext.understander.UnderstandResult.Builder


Builder for creating an UnderstandResult.

Summary

Public constructors

Builder(UnderstandRequest request)

Creates a new builder for an UnderstandResult for the given request.

Public methods

UnderstandResult build()

Builds and returns a new UnderstandResult instance.

UnderstandResult.Builder setFeedbackActivity(PendingIntent feedbackActivity)

Sets the PendingIntent that can be used to launch the feedback activity.

UnderstandResult.Builder setResponseForDestination(int destination, ContextInsight insight)

Sets the response insight for the given destination.

UnderstandResult.Builder setVisualizerSession(InsightVisualizerSession session)

Sets an InsightVisualizerSession to provide interactive visualizations to a client app.

Inherited methods

Public constructors

Builder

Added in version 37.2
public Builder (UnderstandRequest request)

Creates a new builder for an UnderstandResult for the given request.

Parameters
request UnderstandRequest: the request for which an understand result is being built.
This value cannot be null.

Public methods

build

Added in version 37.2
public UnderstandResult build ()

Builds and returns a new UnderstandResult instance.

Returns
UnderstandResult a new UnderstandResult instance.
This value cannot be null.

setFeedbackActivity

Added in version 37.2
public UnderstandResult.Builder setFeedbackActivity (PendingIntent feedbackActivity)

Sets the PendingIntent that can be used to launch the feedback activity.

This activity will be used for feedback for all insights or embedded visualizations displayed from this request.

Parameters
feedbackActivity PendingIntent: This value may be null.

Returns
UnderstandResult.Builder This value cannot be null.

setResponseForDestination

Added in version 37.2
public UnderstandResult.Builder setResponseForDestination (int destination, 
                ContextInsight insight)

Sets the response insight for the given destination.

Up to one insight can be provided for each destination.

Parameters
destination int: single destination for which an insight is being provided

insight ContextInsight: generated insight to provide to that destination.
This value cannot be null.

Returns
UnderstandResult.Builder this Builder instance.
This value cannot be null.

Throws
IllegalArgumentException if an insight was not requested for the given destination

setVisualizerSession

Added in version 37.2
public UnderstandResult.Builder setVisualizerSession (InsightVisualizerSession session)

Sets an InsightVisualizerSession to provide interactive visualizations to a client app.

This is only allowed when ERROR(PersonalContextManager.DESTINATION_EMBEDDED/android.service.personalcontext.PersonalContextManager#DESTINATION_EMBEDDED PersonalContextManager.DESTINATION_EMBEDDED) was requested in the UnderstandRequest.

Parameters
session InsightVisualizerSession: the visualization session to handle requests for this client.
This value may be null.

Returns
UnderstandResult.Builder this Builder instance.
This value cannot be null.

Throws
IllegalArgumentException if ERROR(PersonalContextManager.DESTINATION_EMBEDDED/android.service.personalcontext.PersonalContextManager#DESTINATION_EMBEDDED PersonalContextManager.DESTINATION_EMBEDDED) was not requested