[Android_App] Runtime error "cannot be cast to java.lang.Byte " : java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Byte 에러 ▶ 아래와 같은 소스코드안의 if 문에서 발생을 했습니다. fun getOnePacket(func:ByteArray,aData:ByteArray,dataLen:ByteArray,_timeout:Int):Int { ~~ 중략 ~~ if(dataLen[0] == (0 as Byte)) > Int 형 비교 if(dataLen[0].toInt() == 0) or >> Byte 형 비교 if(dataLen[0] == 0.toByte()) : as 와 toInt 관련 코틀린 사이트 내용 첨부합니다. → as → toInt 참고하세요. Android_app 2023. 6. 21. 15:27
[Android Studio] kotlin to Java 변환하기 : 아래와 같은 코틀린 코드를 java 코드로 변환해 봤습니다. class MainActivity2 : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { RC100_APPTheme { // A surface container using the 'background' color from the theme Surface( modifier = Modifier.fillMaxSize(), color = MaterialTheme.colors.background ) { Greeting("Android") } } } } } @Composable fun.. Android_app 2022. 11. 1. 17:51