【问题标题】:How to upload a pdf file to google drive in android application如何在 Android 应用程序中将 pdf 文件上传到谷歌驱动器
【发布时间】:2015-03-30 14:53:25
【问题描述】:

我正在尝试将新的 pdf 文件上传到 android 应用程序中的谷歌驱动器。但它抛出空异常。它只上传图像格式。所以请给任何建议如何上传pdf文件。

protected void onActivityResult(final int requestCode, final int resultCode, 
                                final Intent data) {
    switch (requestCode) {
        case REQUEST_CODE_CAPTURE_IMAGE:
            if (resultCode == Activity.RESULT_OK) {
                Uri uri = data.getData();
                try {
                    mBitmapToSave = BitmapFactory.decodeStream(
                            getContentResolver().openInputStream(uri));
                    Toast.makeText(getApplicationContext(), filenameSP, 3000).show();
                } catch (FileNotFoundException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                mBitmapToSave = BitmapFactory.decodeStream(
                        getContentResolver().openInputStream(uri));

在这里,我将我的 pdf 文件路径传递给它的 throw nullPointerException

【问题讨论】:

标签: android google-drive-api


【解决方案1】:
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-03-17
  • 1970-01-01
  • 2013-07-11
  • 1970-01-01
相关资源
最近更新 更多