Udostępnij za pośrednictwem


Dataset Class

Definition

A Dataset object represents a group of fields (key / value pairs) used to autofill parts of a screen.

[Android.Runtime.Register("android/service/autofill/Dataset", ApiSince=26, DoNotGenerateAcw=true)]
public sealed class Dataset : Java.Lang.Object, Android.OS.IParcelable, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/service/autofill/Dataset", ApiSince=26, DoNotGenerateAcw=true)>]
type Dataset = class
    inherit Object
    interface IParcelable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
Dataset
Attributes
Implements

Remarks

A Dataset object represents a group of fields (key / value pairs) used to autofill parts of a screen.

For more information about the role of datasets in the autofill workflow, read Build autofill services and the <a href="/reference/android/service/autofill/AutofillService">AutofillService</a> documentation.

"BasicUsage"><h3>Basic usage</h3>

In its simplest form, a dataset contains one or more fields (comprised of an AutofillId id, a AutofillValue value, and an optional filter Pattern regex); and one or more RemoteViews presentations for these fields (each field could have its own RemoteViews presentation, or use the default RemoteViews presentation associated with the whole dataset).

When an autofill service returns datasets in a FillResponse and the screen input is focused in a view that is present in at least one of these datasets, the Android System displays a UI containing the RemoteViews presentation of all datasets pairs that have that view's AutofillId. Then, when the user selects a dataset from the UI, all views in that dataset are autofilled.

If both the current Input Method and autofill service supports inline suggestions, the Dataset can be shown by the keyboard as a suggestion. To use this feature, the Dataset should contain an InlinePresentation representing how the inline suggestion UI will be rendered.

"FillDialogUI"><h3>Fill Dialog UI</h3>

The fill dialog UI is a more conspicuous and efficient interface than dropdown UI. If autofill suggestions are available when the user clicks on a field that supports filling the dialog UI, Autofill will pop up a fill dialog. The dialog will take up a larger area to display the datasets, so it is easy for users to pay attention to the datasets and selecting a dataset. If the user focuses on the view before suggestions are available, will fall back to dropdown UI or inline suggestions.

"Authentication"><h3>Dataset authentication</h3>

In a more sophisticated form, the dataset values can be protected until the user authenticates the dataset&mdash;in that case, when a dataset is selected by the user, the Android System launches an intent set by the service to "unlock" the dataset.

For example, when a data set contains credit card information (such as number, expiration date, and verification code), you could provide a dataset presentation saying "Tap to authenticate". Then when the user taps that option, you would launch an activity asking the user to enter the credit card code, and if the user enters a valid code, you could then "unlock" the dataset.

You can also use authenticated datasets to offer an interactive UI for the user. For example, if the activity being autofilled is an account creation screen, you could use an authenticated dataset to automatically generate a random password for the user.

See Dataset.Builder#setAuthentication(IntentSender) for more details about the dataset authentication mechanism.

"Filtering"><h3>Filtering</h3>

The autofill UI automatically changes which values are shown based on value of the view anchoring it, following the rules below: <ol> <li>If the view's android.view.View#getAutofillValue() autofill value is not AutofillValue#isText() text or is empty, all datasets are shown. <li>Datasets that have a filter regex (set through Field.Builder#setFilter(Pattern) and Dataset.Builder#setField(AutofillId, Field)) and whose regex matches the view's text value converted to lower case are shown. <li>Datasets that do not require authentication, have a field value that is AutofillValue#isText() text and whose AutofillValue#getTextValue() value starts with the lower case value of the view's text are shown. <li>All other datasets are hidden. </ol>

Java documentation for android.service.autofill.Dataset.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Creator
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
DescribeContents()
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
WriteToParcel(Parcel, ParcelableWriteFlags)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to