Antom, leading provider of tailored payment solutions

AMSVaultElement.Builder

AMSVaultElement.Builder is a constructor class used to progressively configure and ultimately create AMSVaultElement instances. After passing the necessary parameters through its constructor, the build() method must be called on the main thread to complete the instance construction.

Constructor

Java
java
new AMSVaultElement.Builder(Activity activity, AMSBaseConfiguration configuration)
Kotlin

kotlin
AMSVaultElement.Builder(activity: Activity, configuration: AMSBaseConfiguration)

Parameters

When creating an AMSVaultElement.Builder instance, you need to pass in the following parameters:
Parameter
Data type
Required
Description
activity
Activity
Yes
The current Activity context.
configuration
AMSBaseConfiguration
Yes
An instance of the AMSBaseConfiguration class, used to provide the configuration required for SDK initialization.

Return value

Returns an AMSVaultElement.Builder instance, which is used to continue configuring and constructing the AMSVaultElement object.

build()

After completing the Builder initialization, call the build() method to construct the AMSVaultElement instance.

Method signature

Java
java
public AMSVaultElement build()
Kotlin

kotlin
fun build(): AMSVaultElement?

Parameters

This method takes no parameters.

Return value

Returns the constructed AMSVaultElement instance. This instance contains the following methods:
Note: If configuration is null, then null is returned. If not called on the main thread, RuntimeException will be thrown.
Method name
Description
preload()
Used to preload WebApp page and KYC page resources.
createComponent()
Used to create and display the binding component UI.
reset()
Used to reset the binding process and clear the current state.
Used to destroy the instance and release all associated resources.

Sample

java
AMSBaseConfiguration configuration = new AMSBaseConfiguration();
configuration.setLocale(new Locale("en", "US"));
configuration.setOption("sandbox", true);

AMSVaultElement vaultElement = new AMSVaultElement.Builder(activity, configuration).build();