如何从android中的谷歌驱动器中选择文件? [英] How to select files from google drive in android?

查看:94
本文介绍了如何从android中的谷歌驱动器中选择文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法可以在android应用中启动Google Drive的文件选取器 - 可以做类似于 http://googleappsdeveloper.blogspot.com/2012/08/allowing-user-to-select-google-drive.html 。我需要允许用户从谷歌驱动器中选择文件,所以我可以在我的应用程序中使用它们的字节。感谢。

解决方案

是的, GDAA 。使用此演示的最佳位置,特别是 Intents 部分。



演示中有2种方法感兴趣的:
$ b $ ol

  • '选择一个带有opener活动的文件',

  • 和'Pick一个打开器活动的文件夹'

  • 但它们基本相同,只有在这里指定的MIME TYPE过滤器不同:

      IntentSender intentSender = Drive.DriveApi.newOpenFileActivityBuilder()
    .setMimeType(new String [] {DriveFolder.MIME_TYPE})//< ; --- FOLDER
    //.setMimeType(new String [] {text / plain,text / html})//< - TEXT FILES
    .build(getGoogleApiClient()) ;

    好运

    Is there any way to start file picker for google drive in android app - to do something similar to this http://googleappsdeveloper.blogspot.com/2012/08/allowing-user-to-select-google-drive.html. I need to allow user to select files from google drive, so I can use their bytes in my application. Thanks.

    解决方案

    Yes, there is a file picker in the GDAA. The best place to see it's use is this demo, specifically the Intents section.

    There are 2 methods in the demo you are interested in:

    1. the 'Pick a file with opener activity' ,
    2. and the 'Pick a folder with opener activity'

    but they are essentially the same, differing only in the MIME TYPE filter specified here:

    IntentSender intentSender = Drive.DriveApi.newOpenFileActivityBuilder()
     .setMimeType(new String[] { DriveFolder.MIME_TYPE })  // <--- FOLDER
     //.setMimeType(new String[] { "text/plain", "text/html" }) // <- TEXT FILES
     .build(getGoogleApiClient());
    

    Good Luck

    这篇关于如何从android中的谷歌驱动器中选择文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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