PanicMonster
01/04/2022, 2:38 PMfun f(){
val reportAbout = binding.createReportReportAboutTextView.text.toString()
val reportDesc = binding.createReportEditText.text.toString()
var imageURL = ""
var videoURL = ""
val timestamp = System.currentTimeMillis()/1000
var filename = UUID.randomUUID().toString()
imgref = FirebaseStorage.getInstance().getReference("/report_videos/$filename")
if(selectedVideoURI!=null)
imgref.putFile(selectedVideoURI!!).addOnSuccessListener {
imgref.downloadUrl.addOnSuccessListener {
videoURL = it.toString()
ref.setValue(ReportModel(ref.key.toString(),reportAbout ,reportDesc,imageURL,videoURL,timestamp))
}
}
// LOG.d("TAG","$videoURL")
}
whenever i print videoURL in logcat, it shows empty, but inside imgref.putFile() function it has some value. does the imgref.putFile() funciton executes last in order? how can i execute the commented line in last by order.Daniel Dawson
01/05/2022, 9:22 PM