FileDocCategorySizeDatePackage
SuggestionsInfo.javaAPI DocAndroid 5.1 API6062Thu Mar 12 22:22:10 GMT 2015android.view.textservice

SuggestionsInfo

public final class SuggestionsInfo extends Object implements android.os.Parcelable
This class contains a metadata of suggestions from the text service

Fields Summary
private static final String[]
EMPTY
public static final int
RESULT_ATTR_IN_THE_DICTIONARY
Flag of the attributes of the suggestions that can be obtained by {@link #getSuggestionsAttributes}: this tells that the requested word was found in the dictionary in the text service.
public static final int
RESULT_ATTR_LOOKS_LIKE_TYPO
Flag of the attributes of the suggestions that can be obtained by {@link #getSuggestionsAttributes}: this tells that the text service thinks the requested word looks like a typo.
public static final int
RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS
Flag of the attributes of the suggestions that can be obtained by {@link #getSuggestionsAttributes}: this tells that the text service thinks the result suggestions include highly recommended ones.
private final int
mSuggestionsAttributes
private final String[]
mSuggestions
private final boolean
mSuggestionsAvailable
private int
mCookie
private int
mSequence
public static final Parcelable.Creator
CREATOR
Used to make this class parcelable.
Constructors Summary
public SuggestionsInfo(int suggestionsAttributes, String[] suggestions)
Constructor.

param
suggestionsAttributes from the text service
param
suggestions from the text service


                      
         
        this(suggestionsAttributes, suggestions, 0, 0);
    
public SuggestionsInfo(int suggestionsAttributes, String[] suggestions, int cookie, int sequence)
Constructor.

param
suggestionsAttributes from the text service
param
suggestions from the text service
param
cookie the cookie of the input TextInfo
param
sequence the cookie of the input TextInfo

        if (suggestions == null) {
            mSuggestions = EMPTY;
            mSuggestionsAvailable = false;
        } else {
            mSuggestions = suggestions;
            mSuggestionsAvailable = true;
        }
        mSuggestionsAttributes = suggestionsAttributes;
        mCookie = cookie;
        mSequence = sequence;
    
public SuggestionsInfo(android.os.Parcel source)

        mSuggestionsAttributes = source.readInt();
        mSuggestions = source.readStringArray();
        mCookie = source.readInt();
        mSequence = source.readInt();
        mSuggestionsAvailable = source.readInt() == 1;
    
Methods Summary
public intdescribeContents()
Used to make this class parcelable.


               
    
       
        return 0;
    
public intgetCookie()

return
the cookie which may be set by a client application

        return mCookie;
    
public intgetSequence()

return
the sequence which may be set by a client application

        return mSequence;
    
public java.lang.StringgetSuggestionAt(int i)

param
i the id of suggestions
return
the suggestion at the specified id

        return mSuggestions[i];
    
public intgetSuggestionsAttributes()

return
the attributes of suggestions. This includes whether the spell checker has the word in its dictionary or not and whether the spell checker has confident suggestions for the word or not.

        return mSuggestionsAttributes;
    
public intgetSuggestionsCount()

return
the count of the suggestions. If there's no suggestions at all, this method returns -1. Even if this method returns 0, it doesn't necessarily mean that there are no suggestions for the requested word. For instance, the caller could have been asked to limit the maximum number of suggestions returned.

        if (!mSuggestionsAvailable) {
            return -1;
        }
        return mSuggestions.length;
    
public voidsetCookieAndSequence(int cookie, int sequence)
Set the cookie and the sequence of SuggestionsInfo which are set to TextInfo from a client application

param
cookie the cookie of an input TextInfo
param
sequence the cookie of an input TextInfo

        mCookie = cookie;
        mSequence = sequence;
    
public voidwriteToParcel(android.os.Parcel dest, int flags)
Used to package this object into a {@link Parcel}.

param
dest The {@link Parcel} to be written.
param
flags The flags used for parceling.

        dest.writeInt(mSuggestionsAttributes);
        dest.writeStringArray(mSuggestions);
        dest.writeInt(mCookie);
        dest.writeInt(mSequence);
        dest.writeInt(mSuggestionsAvailable ? 1 : 0);