Stay organized with collections
Save and categorize content based on your preferences.
TypeConverter
abstract class TypeConverter<T : Any!, V : Any!>
Abstract base class used convert type T to another type V. This is necessary when the value types of in animation are different from the property type.
Summary
Public methods |
abstract V |
Converts a value from one type to another.
|
Public constructors
TypeConverter
TypeConverter(
fromClass: Class<T>!,
toClass: Class<V>!)
Public methods
convert
abstract fun convert(value: T): V
Converts a value from one type to another.
Parameters |
value |
T: The Object to convert. |
Return |
V |
A value of type V, converted from value . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# TypeConverter\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nTypeConverter\n=============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/animation/TypeConverter \"View this page in Java\") \n\n```\nabstract class TypeConverter\u003cT : Any!, V : Any!\u003e\n```\n\n|---|--------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.animation.TypeConverter](#) |\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [BidirectionalTypeConverter](/reference/kotlin/android/animation/BidirectionalTypeConverter) |----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------| | [BidirectionalTypeConverter](/reference/kotlin/android/animation/BidirectionalTypeConverter) | Abstract base class used convert type T to another type V and back again. | |\n\nAbstract base class used convert type T to another type V. This is necessary when the value types of in animation are different from the property type.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [TypeConverter](#TypeConverter(java.lang.Class,%20java.lang.Class))`(`fromClass:` `[Class](../../java/lang/Class.html#)\u003cT\u003e!`, `toClass:` `[Class](../../java/lang/Class.html#)\u003cV\u003e!`)` \u003cbr /\u003e |\n\n| Public methods ||\n|------------|-------------------------------------------------------------------------------------------------------------------|\n| abstract V | [convert](#convert(android.animation.TypeConverter.T))`(`value:` `T`)` Converts a value from one type to another. |\n\nPublic constructors\n-------------------\n\n### TypeConverter\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nTypeConverter(\n fromClass: Class\u003cT\u003e!, \n toClass: Class\u003cV\u003e!)\n```\n\nPublic methods\n--------------\n\n### convert\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun convert(value: T): V\n```\n\nConverts a value from one type to another.\n\n| Parameters ||\n|---------|---------------------------|\n| `value` | T: The Object to convert. |\n\n| Return ||\n|---|--------------------------------------------|\n| V | A value of type V, converted from `value`. |"]]