본문 바로가기
android

에러 : java.util.IllegalFormatConversionException: d != java.lang.String

by liz_devel 2021. 11. 9.

에러 내용: java.util.IllegalFormatConversionException: d != java.lang.String

헤결 방안:

1. 기존 코드

   tvSplitPrice.text = String.format("%,d", item.productPrice)

2. 변경 코드

   tvSplitPrice.text = String.format("%,d", item.productPrice.toInt())

 

아래와 같이 String을 Int형으로 바꾼 뒤 String.format 해줌

반응형