0
I want to get a special file from the user. It has how to put the name of this file as type
in Intent
? For an image for example, use:
Intent intent = new Intent(Intent.ACTION_PICK)
intent.setType("image/*")
startActivityForResult(intent, 1)
You can set the name of the file I want in setType()
to appear only him and the directories? The file is a "backup" of the database called "tobuy.db".
Want to validate by mime or extension? If it is by mime just swap the string.
– Jéf Bueno
@LINQ, but in case I change the string to what? vi que pdf, for example, is used "application/pdf", which I could use as a string to look only for the file "tobuy.db" (or with the extension . db)?
– underfilho
I don’t really understand how things work on Android. Tell me: is there any XML (or similar) file attached to the file that contains the code of your question?
– Jéf Bueno
@LINQ, no, it’s just this code, it basically calls Intent.ACTION_PICK and apps that have activitys that receive this Intent (or something like that) will appear to be chosen (like Manage file or gallery)then I would have to pass setType as an argument for him to know what to show (as only images, for example), so I wanted to let him choose only files with a certain name, but I don’t know if this is possible
– underfilho
uses autocomplete and tries to search for some method called setPath, setPathPattern or similar
– Jéf Bueno
already searched, I saw in the documentation of android and has a list of various types of files and how is the mime of it, but it seems that are for things predefined by the file manager, so I saw there is no way you "create one", but there is and someone answer me right ashuahsuas
– underfilho
https://stackoverflow.com/questions/14256537/android-intent-filter-for-custom-file-extension ???
– Israel Merljak
@Israelmerljak, actually I wanted the Android File Manager (or the qlqr app Activity that receives this app) to show only files with that extension or name, is it possible or will I have to see if I can find a lib in particular? (or you’ll see there’s no such thing)
– underfilho