As shown below, when I kept an instance of [DateFormat] 1 as a member variable and reused it, a crash report came up in Fabric.
class Util {
companion object {
private val sDateFormat = SimpleDateFormat("yyyy/MM/dd")
fun convert(date: Date): String {
return sDateFormat.format(date)
}
}
}
After investigating, it is an implementation that is called from multiple threads, and as shown in [Document] 1, it was changed to generate an instance every time.
class Util {
companion object {
fun convert(date: Date): String {
return SimpleDateFormat("yyyy/MM/dd").format(date)
}
}
}
Recommended Posts