Rus*_*lde 3 android android-intent google-drive-api
我创建了一个简单的记事本应用程序,它实现了ACTION_SEND共享意图来共享笔记.
我的数据具有的MIME类型为"text/plain的"和谷歌驱动器(原谷歌文档)是提供作为我的设备上的选择,当我选择谷歌驱动器出现错误通过"此项目不能被上传的谷歌文档"吐司留言.
我像这样创建我的共享意图:
Intent share_intent = new Intent(android.content.Intent.ACTION_SEND);
share_intent.setType("text/plain");
share_intent.putExtra(android.content.Intent.EXTRA_SUBJECT, name);
share_intent.putExtra(android.content.Intent.EXTRA_TEXT, content);
startActivity(share_intent);
Run Code Online (Sandbox Code Playgroud)
像Mail,Messaging,Twitter和Wordpress这样的应用程序似乎都很好地处理了这个意图并至少分享了EXTRA_TEXT内容.
我想知道是否有一种方法可以让Google Drive成功上传笔记,或者至少更好地处理意图?
我是Android新手所以请原谅我的愚蠢,如果这是一个愚蠢的问题.我正在针对最低版本的SDK 15开发,如果这有帮助的话.
这是一个错误消息的屏幕抓取:

在LogCat中,我再次发现了错误消息:
05-13 23:31:46.906: E/UploadSharedItemActivity(14594): This item cannot be uploaded as Google Document.
Run Code Online (Sandbox Code Playgroud)
在错误消息之前还会出现警告:
05-13 23:31:46.250: W/ND(14594): Could not load Finalizer in its own class loader. Loading Finalizer in the current class loader instead. As a result, you will not be able to garbage collect this class loader. To support reclaiming this class loader, either resolve the underlying issue, or move Google Collections to your system class path.
05-13 23:31:46.250: W/ND(14594): java.io.FileNotFoundException: com/google/inject/internal/Finalizer.class
05-13 23:31:46.250: W/ND(14594): at NE.a(FinalizableReferenceQueue.java:269)
05-13 23:31:46.250: W/ND(14594): at NE.a(FinalizableReferenceQueue.java:253)
Run Code Online (Sandbox Code Playgroud)
我不知道这是否相关.
如果有帮助,我可以将整个LogCat转储到这里.
Eti*_*nne 10
您无法与google文档共享文本,但可以共享文件(文本文件或其他文件)因此,只需将文本保存到应用程序内的文件中,然后与Intent共享该文件:
Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + your_file_path));
startActivity(Intent.createChooser(intent, ""));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5625 次 |
| 最近记录: |