diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt index 50c33bd35c60ba..eb14eee23770bd 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt @@ -199,10 +199,19 @@ class ClusterDetailFragment : Fragment() { private fun castStringToType(data: String, type: Class<*>, underlyingType: Class<*>): Any? { return when (type) { - Int::class.java -> data.toInt() - Boolean::class.java -> data.toBoolean() + Int::class.java, + java.lang.Integer::class.java -> data.toInt() + Boolean::class.java, + java.lang.Boolean::class.java -> data.toBoolean() ByteArray::class.java -> data.encodeToByteArray() - Long::class.java -> data.toLong() + Long::class.java, + java.lang.Long::class.java -> data.toLong() + Short::class.java, + java.lang.Short::class.java -> data.toShort() + Double::class.java, + java.lang.Double::class.java -> data.toDouble() + Float::class.java, + java.lang.Float::class.java -> data.toFloat() Optional::class.java -> if (data.isEmpty()) Optional.empty() else Optional.of(castStringToType(data, underlyingType, underlyingType)!!)