public class

AutofillIdCompat

extends java.lang.Object

 java.lang.Object

↳androidx.core.view.autofill.AutofillIdCompat

Gradle dependencies

compile group: 'androidx.core', name: 'core', version: '1.15.0-alpha02'

  • groupId: androidx.core
  • artifactId: core
  • version: 1.15.0-alpha02

Artifact androidx.core:core:1.15.0-alpha02 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.core:core com.android.support:support-compat

Overview

Helper for accessing features in .

Summary

Methods
public AutofillIdtoAutofillId()

Provides the represented by this object.

public static AutofillIdCompattoAutofillIdCompat(AutofillId autofillId)

Provides a backward-compatible wrapper for .

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods

public static AutofillIdCompat toAutofillIdCompat(AutofillId autofillId)

Provides a backward-compatible wrapper for .

This method is not supported on devices running SDK < 26 since the platform class will not be available.

Parameters:

autofillId: platform class to wrap

Returns:

wrapped class

public AutofillId toAutofillId()

Provides the represented by this object.

This method is not supported on devices running SDK < 26 since the platform class will not be available.

Returns:

platform class object

See also: AutofillIdCompat.toAutofillIdCompat(AutofillId)

Source

/*
 * Copyright 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.core.view.autofill;

import android.view.autofill.AutofillId;

import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;

/**
 * Helper for accessing features in {@link AutofillId}.
 */
public class AutofillIdCompat {
    // Only guaranteed to be non-null on SDK_INT >= 26.
    private final Object mWrappedObj;

    @RequiresApi(26)
    private AutofillIdCompat(@NonNull AutofillId obj) {
        mWrappedObj = obj;
    }

    /**
     * Provides a backward-compatible wrapper for {@link AutofillId}.
     * <p>
     * This method is not supported on devices running SDK < 26 since the platform
     * class will not be available.
     *
     * @param autofillId platform class to wrap
     * @return wrapped class
     */
    @RequiresApi(26)
    @NonNull
    public static AutofillIdCompat toAutofillIdCompat(@NonNull AutofillId autofillId) {
        return new AutofillIdCompat(autofillId);
    }

    /**
     * Provides the {@link AutofillId} represented by this object.
     * <p>
     * This method is not supported on devices running SDK < 26 since the platform
     * class will not be available.
     *
     * @return platform class object
     * @see AutofillIdCompat#toAutofillIdCompat(AutofillId)
     */
    @RequiresApi(26)
    @NonNull
    public AutofillId toAutofillId() {
        return (AutofillId) mWrappedObj;
    }
}