question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

openFilePicker() asks for folders

See original GitHub issue

Hello! I have this code, which uses storageHelper.openFilePicker(), and it asks me to open a folder anyway. I can select a folder and can’t click on a file (it doesn’t do anything), just like a folder picker. I guess it’s an android issue?

MainActivity.kt
class ListFilesActivity : AppCompatActivity() {
    private lateinit var storageHelper: SimpleStorageHelper

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        storageHelper = SimpleStorageHelper(this, savedInstanceState)

        storageHelper.requestStorageAccess()

        storageHelper.onFileSelected = { i: Int, documentFile: DocumentFile ->
            println(documentFile.name)
        }

        storageHelper.openFilePicker()
    }

    override fun onSaveInstanceState(outState: Bundle) {
        storageHelper.storage.onSaveInstanceState(outState)
        super.onSaveInstanceState(outState)
    }

    override fun onRestoreInstanceState(savedInstanceState: Bundle) {
        super.onRestoreInstanceState(savedInstanceState)
        storageHelper.storage.onRestoreInstanceState(savedInstanceState)
    }
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
anggrayudicommented, Mar 3, 2021

It is a known bug on 0.4.4. The fixes will be on 0.5.0.

0reactions
victorbnlcommented, Mar 10, 2021

Yes it works in the Snapshot! Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Open files and folders with a picker - UWP - Microsoft Learn
Access files and folders by letting the user interact with a picker. You can use the FileOpenPicker and FileSavePicker classes to gain ...
Read more >
Window.showOpenFilePicker() - Web APIs - MDN Web Docs
The showOpenFilePicker() method of the Window interface shows a file picker that allows a user to select a file or multiple files and ......
Read more >
UWP how to get access to file in folder - Stack Overflow
FileOpenPicker gives you a StorageFile which wraps the opened files and gives you permission to it. This ...
Read more >
How to use FilePicker and FolderPicker in WinUI 3 ... - GitHub
var filePicker = new FileOpenPicker(); // Get the current window's HWND by passing in the Window object var hwnd = WinRT.Interop.WindowNative.
Read more >
The File System Access API: simplifying access to local files
When this happens, the browser shows a modal prompt and ask the user to choose a different folder. # Modifying an existing file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found