How do I make use of application classes to store non-persistent data that can be shared among activities ? The following application has an array of type TicketClass. I would liek to be able to access and append to this array in any activities. I can't seem to find any information on this. Kindly guide me, thank you.
import android.app.Application
import java.text.SimpleDateFormat
class TicketApplication: Application() {
var moviesArray:ArrayList<TicketClass>? = null
var sdf:SimpleDateFormat? = null
init {
}
fun getDateFormat():SimpleDateFormat?{
return sdf
}
fun addTicket(ticket:TicketClass){
ticketArray?.add(ticket)
}
fun getArray():ArrayList<TicketClass>?{
return ticketArray
}
}