如何在android应用程序中将pdf文件上载到google drive

如何在android应用程序中将pdf文件上载到google drive,android,google-drive-api,Android,Google Drive Api,我正在尝试将新的pdf文件上传到android应用程序中的google drive。但它抛出空异常。它只上传图像格式。因此,请给出如何上传pdf文件的建议 protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) { switch (requestCode) { case R

我正在尝试将新的pdf文件上传到android应用程序中的google drive。但它抛出空异常。它只上传图像格式。因此,请给出如何上传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

您应该检查以下链接


您可以查看此链接[[1]:与我所做的相同,但它不起作用…没有堆栈跟踪和相应的行号代码?