Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Internet Explorer alert
This browser is not recommended for use with smartdevicelink.com, and may not function properly. Upgrade to a different browser to guarantee support of all features.
close alert
To Top Created with Sketch. To Top
To Bottom Created with Sketch. To Bottom
Android Documentation
Choice

Class Choice

Hierarchy

java.lang.Object
     com.smartdevicelink.proxy.RPCStruct

Package
com.smartdevicelink.proxy.rpc

Overview

A choice is an option which a user can select either via the menu or via voice recognition (VR) during an application initiated interaction. For example, the application may request for the user`s choice among several suggested ones: Yes, No, Skip.

Parameter List

Name Type Description SmartDeviceLink Ver. Available
choiceID Integer Application-scoped identifier that uniquely identifies this choice. Min: 0; Max: 65535 SmartDeviceLink 1.0
menuName String Text which appears in menu, representing this choice. Min: 1; Max: 100 SmartDeviceLink 1.0
vrCommands String[] An array of strings to be used as VR synonyms for this choice. If this array is provided, it must have at least one non-empty element SmartDeviceLink 1.0
image Image Either a static hex icon value or a binary image file name identifier (sent by PutFile). SmartDeviceLink 2.0

Fields

KEY_SECONDARY_TEXT

public static final java.lang.String KEY_SECONDARY_TEXT
Constant Value
"secondaryText"

KEY_TERTIARY_TEXT

public static final java.lang.String KEY_TERTIARY_TEXT
Constant Value
"tertiaryText"

KEY_SECONDARY_IMAGE

public static final java.lang.String KEY_SECONDARY_IMAGE
Constant Value
"secondaryImage"

KEY_MENU_NAME

public static final java.lang.String KEY_MENU_NAME
Constant Value
"menuName"

KEY_VR_COMMANDS

public static final java.lang.String KEY_VR_COMMANDS
Constant Value
"vrCommands"

KEY_CHOICE_ID

public static final java.lang.String KEY_CHOICE_ID
Constant Value
"choiceID"

KEY_IMAGE

public static final java.lang.String KEY_IMAGE
Constant Value
"image"

Inherited Fields

From Class Fields
com.smartdevicelink.proxy.RPCStruct KEY_BULK_DATA, KEY_PROTECTED, store

Constructors

Choice()

Constructs a newly allocated Choice object

public Choice()

Choice( java.util.Hashtable<java.lang.String, java.lang.Object> hash )

Constructs a newly allocated Choice object indicated by the Hashtable parameter

public Choice(java.util.Hashtable<java.lang.String, java.lang.Object> hash)

Constructor Parameters

hash
The Hashtable to use

Choice( Integer choiceID, String menuName )

Constructs a newly allocated Choice object

public Choice(Integer choiceID,String menuName)

Constructor Parameters

choiceID
Min: 0 Max: 65535
menuName
the menu name

Methods

format( Version rpcVersion, boolean formatParams )

VrCommands became optional as of RPC Spec 5.0. On legacy systems, we must still set VrCommands, as they are expected, even though the developer may not specify them.

Additionally, VrCommands must be unique, therefore we will use the string value of the command's ID

public void format(Version rpcVersion,boolean formatParams)

Method Parameters

rpcVersion
the rpc spec version that has been negotiated. If value is null the the max value of RPC spec version this library supports should be used.
formatParams
if true, the format method will be called on subsequent params

getChoiceID()

Get the application-scoped identifier that uniquely identifies this choice.

public java.lang.Integer getChoiceID()

setChoiceID( Integer choiceID )

Set the application-scoped identifier that uniquely identifies this choice.

public com.smartdevicelink.proxy.rpc.Choice setChoiceID(Integer choiceID)

Method Parameters

choiceID
Min: 0 Max: 65535

getMenuName()

Text which appears in menu, representing this choice. Min: 1; Max: 100

public java.lang.String getMenuName()

setMenuName( String menuName )

Text which appears in menu, representing this choice. Min: 1; Max: 100

public com.smartdevicelink.proxy.rpc.Choice setMenuName(String menuName)

Method Parameters

menuName
the menu name

getVrCommands()

Get an array of strings to be used as VR synonyms for this choice. If this array is provided, it must have at least one non-empty element

public java.util.List getVrCommands()

setVrCommands( java.util.List<java.lang.String> vrCommands )

Set an array of strings to be used as VR synonyms for this choice. If this array is provided, it must have at least one non-empty element

public com.smartdevicelink.proxy.rpc.Choice setVrCommands(java.util.List<java.lang.String> vrCommands)

Method Parameters

vrCommands
the List of vrCommands

setImage( Image image )

Set the image

public com.smartdevicelink.proxy.rpc.Choice setImage(Image image)

Method Parameters

image
the image of the choice

getImage()

Get the image

public com.smartdevicelink.proxy.rpc.Image getImage()

getSecondaryText()

public java.lang.String getSecondaryText()

setSecondaryText( String secondaryText )

public com.smartdevicelink.proxy.rpc.Choice setSecondaryText(String secondaryText)

Method Parameters

secondaryText

getTertiaryText()

public java.lang.String getTertiaryText()

setTertiaryText( String tertiaryText )

public com.smartdevicelink.proxy.rpc.Choice setTertiaryText(String tertiaryText)

Method Parameters

tertiaryText

setSecondaryImage( Image image )

public com.smartdevicelink.proxy.rpc.Choice setSecondaryImage(Image image)

Method Parameters

image

getSecondaryImage()

public com.smartdevicelink.proxy.rpc.Image getSecondaryImage()

setIgnoreAddingVRItems( boolean ignoreAddingVRItems )

This prevents the @{link Choice#format} method from adding VR commands if set to true

public com.smartdevicelink.proxy.rpc.Choice setIgnoreAddingVRItems(boolean ignoreAddingVRItems)

Method Parameters

ignoreAddingVRItems
- whether or not to let the format method add vr commands

Inherited Methods

From Class Methods
com.smartdevicelink.proxy.RPCStruct getStoreValue, getStore, deserializeJSON, serializeJSON, serializeJSON, format, getBulkData, setBulkData, setPayloadProtected, isPayloadProtected, getMessageTypeName, hasKey, setValue, getValue, getObject, formatObject, getValueForString, getString, getInteger, getDouble, getFloat, getBoolean, getLong, clone, equals, hashCode
java.lang.Object getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize
View on GitHub.com
Previous Section Next Section