Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I got all files from my Google drive and has populated it in the list View. These files are of different types (image file, doc file, text file etc). Now i want to display that file to the user, like if it is an image file then it should display to the user, or if it is a text file then text should display to user etc
Posted

1 solution

If you want to open any file which you have retrieved from Drive, then this can be done easily while using the resources of Google Drive app. First of all install the Google Drive app from play market Install Google Drive app from here

After that use this code to open your file.

FileID=file.getId();//it is your file ID which you want to display

String url = "https://docs.google.com/file/d/"+FileID;
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);

It will display your file of any type(image, pdf, doc, txt etc)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900