0

Like example I have 10 images in my database and i want to retrive first image when I retrive first image after 15 minutes i want to retrive the second image...

 database.addValueEventListener(object :ValueEventListener{
        override fun onDataChange(snapshot: DataSnapshot) {
            for (data in snapshot.children){
                val image = data.child("myimage").value.toString()
                val voice = data.child("myvoice").value.toString()
                imagedatas=Data.Builder().putString("image",image).build()
                val model=automodel(image,voice)
                binding.recyclerview.layoutManager= LinearLayoutManager(this@AutoChangeActivity)
                binding.recyclerview.layoutManager= GridLayoutManager(this@AutoChangeActivity,2)
                binding.recyclerview.adapter=adapter
            
                arrayList.add(model)
            }
            val myWorkRequest : PeriodicWorkRequest = PeriodicWorkRequestBuilder<WallpaperWorker>(1,
                TimeUnit.MINUTES)
                .setConstraints(constraints)
                .setInputData(imagedatas)
                .build()
            WorkManager.getInstance(this@AutoChangeActivity).enqueue(myWorkRequest)
        }
        override fun onCancelled(error: DatabaseError) {

        }

      })

.

  • Tell us what is wrong with shared code. Do you have any errors? – Alex Mamo Nov 19 '22 at 10:39
  • I added this code so they wouldn't delete my question i dont know how to do this (Like example I have 10 images in my database and i want to retrive first image when I retrive first image after 15 minutes i want to retrive the second image...) Do you have any idea to do that? – MehmetEminKisbet Nov 19 '22 at 10:57
  • Are you asking [how to run a periodic task in android](https://www.google.com/search?q=how+to+run+a+periodic+task+in+android)? – Frank van Puffelen Nov 19 '22 at 15:08
  • No I am not asking this @FrankvanPuffelen my database looking like this when user – MehmetEminKisbet Nov 19 '22 at 15:18
  • I edit the question you can look now how my database looking when user select image – MehmetEminKisbet Nov 19 '22 at 15:25
  • Like example the user select 97 image but i want to retrive id=1 image when i retrive id=1 image 15 minutes later i want to retrive id=2 image – MehmetEminKisbet Nov 19 '22 at 15:29

0 Answers0