MainActivity.kt
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val save = registerForActivityResult(ActivityResultContracts.CreateDocument()) {
Log.d("<debug>", "uri: $it")
}
findViewById<Button>(R.id.button).setOnClickListener {
save.launch("file")
}
}
}
- Navigating to the Download folder, only irrelevant files
- Using the code above, saving 1 file
- If I re-run the code to save a file again
- Navigating to the Download folder
Basically, whenever I delete the file in Download and re-run the code, it displays all the previously created files, even though there's only 1 in there.
note: the issue persists even if I delete then reinstall the app or power cycle the device (pixel 3, pixel 6 both on android 12)