如何显示/打开我的Google云端硬盘文件 [英] How to display/open my Google drive file

查看:463
本文介绍了如何显示/打开我的Google云端硬盘文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从我的Google云端硬盘获取了所有文件,并在列表视图中填充了该文件。这些文件的类型不同(图像文件,doc文件,文本文件等)。现在我想向用户显示该文件,就好像它是一个图像文件然后它应该显示给用户,或者如果它是一个文本文件,那么文本应该显示给用户等

解决方案

如果您要打开从云端硬盘检索到的任何文件,则可以在使用Google云端硬盘应用的资源时轻松完成此操作。首先从游戏市场安装Google云端硬盘应用安装Google云端硬盘应用这里



之后使用此代码打开你的文件。



FileID = file .getId(); //这是你要显示的文件ID



String url =https://docs.google.com/file/d /+ FileID;

意图i =新意图(Intent.ACTION_VIEW);

i.setData(Uri.parse(url));

startActivity(i);



它将显示您的任何类型的文件(图像,pdf,doc,txt等)

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

解决方案

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)


这篇关于如何显示/打开我的Google云端硬盘文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆