Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/200.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在android中使用google drive api下载文件并保存到sd卡_Android_Google Drive Api_Google Drive Android Api - Fatal编程技术网

在android中使用google drive api下载文件并保存到sd卡

在android中使用google drive api下载文件并保存到sd卡,android,google-drive-api,google-drive-android-api,Android,Google Drive Api,Google Drive Android Api,我想使用google drive api从google drive下载一个文件,下载文件后,我想将文件保存到我的sd卡中 我已经得到了我想要像那样下载的资源id @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.i(TAG, "in onActivityResult() - triggered on pressing Select"); swi

我想使用google drive api从google drive下载一个文件,下载文件后,我想将文件保存到我的sd卡中

我已经得到了我想要像那样下载的资源id

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    Log.i(TAG, "in onActivityResult() - triggered on pressing Select");
    switch (requestCode) {
        case REQUEST_CODE_SELECT:
            if (resultCode == RESULT_OK) {
                /*get the selected item's ID*/
                DriveId driveId = (DriveId) data.getParcelableExtra(
                        OpenFileActivityBuilder.EXTRA_RESPONSE_DRIVE_ID);//this extra contains the drive id of the selected file
                Log.i(TAG, "Selected folder's ID: " + driveId.encodeToString());
                Log.i(TAG, "Selected folder's Resource ID: " + driveId.getResourceId());

                Toast.makeText(getApplicationContext(),driveId.encodeToString()+":"+driveId.getResourceId() , Toast.LENGTH_LONG).show();

            }
            finish();
            break;

        case REQUEST_CODE_RESOLUTION:
            if (resultCode == RESULT_OK) {
                Log.i(TAG, "in onActivityResult() - resolving connection, connecting...");
                googleApiClient.connect();
            }
            break;


        default:
            super.onActivityResult(requestCode, resultCode, data);
            break;
    }
}
现在我不知道如何使用该文件的资源id下载该文件,然后保存到sd卡。 我在谷歌上搜索了很多,但找不到合适的解决方案。 有人能帮我解决这个问题吗???

你退房了吗?