Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

343
Views
Convertidor de tipo de calendario para habitaciones (Kotlin)

Estoy tratando de conservar una marca de tiempo en la base de datos de mi habitación usando el siguiente TypeConverter :

 class Converters { @TypeConverter fun fromTimestamp(value: Long?): Calendar? { if(value == null) return null val cal = GregorianCalendar() cal.timeInMillis = value return cal } @TypeConverter fun toTimestamp(timestamp: Calendar?): Long? { if(timestamp == null) return null return timestamp.timeInMillis } }

Dos de mis Entidades incluyen la siguiente columna:

 @ColumnInfo(name = "timestamp") val timestamp: Calendar?,

Pero recibo un error de compilación al intentar compilar el proyecto; no tuve problemas al usar el ejemplo de Date TypeConverter de la guía de referencia para desarrolladores.

No puedo ver cuál es el error real, ya que solo obtengo un montón de errores de enlace de datos 'no se puede encontrar el símbolo' si hay algún problema con el código relacionado con Room.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Usar:

 object Converters { @TypeConverter @JvmStatic fun fromTimestamp(value: Long?): Calendar? = value?.let { value -> GregorianCalendar().also { calendar -> calendar.timeInMillis = value } } @TypeConverter @JvmStatic fun toTimestamp(timestamp: Calendar?): Long? = timestamp?.timeInMillis }

Y

 @TypeConverters(Converters::class) abstract class AppDatabase : RoomDatabase() {
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!