I'm having an Android Ftp Client, I download different types of files (.txt , .pdf , .mp3) from the server. And then I list all the files I downloaded.
So my questions are as follows:
If the file is on the SD card & I listed the files by their names. What I want to do is that by clicking on the name the file is opened. Meaning if the file name is "test.pdf" & I clicked on it it should be opened in the same way the pdf file is opened in the pdf viewer, Same thing goes for mp3 files for example, by clicking on the file I want it to be played.
Thanks alot for the help in advance
Create an ACTION_VIEW
Intent
, using Uri.fromFile()
for the Uri
, and with a MIME type suitable for the type of content (e.g., you might decide to use application/pdf
for .pdf
files). Then, call startActivity()
on that Intent.
There may be an open source Android file manager app that you could examine to see how they approach it.