我试图以编程方式获取我的谷歌驱动器中的文件夹名称,并在文件夹内创建一个文件夹,但没有办法。
\n\n我已经查看了这个文档:
\n\n\n\n但如何获取特定文件夹并在其中创建另一个文件夹?以编程方式,而不是通过助手。
\n\n好的。我需要将位图更新到谷歌驱动器。我尝试使用这段代码但不起作用
\n\n String IdFolder = (String) objects[0];\n Bitmap bitmapUpload = (Bitmap) objects[1];\n\n File fileMetadata = new File();\n fileMetadata.setTitle("photo.jpg");\n fileMetadata.setParents(Collections.singletonList(new ParentReference().setId(IdFolder)));\n\n File file = mService.files().insert(fileMetadata, bitmapUpload)\n .setFields("id, parents")\n .execute();\n System.out.println("File ID: " + file.getId());\nRun Code Online (Sandbox Code Playgroud)\n\n我已经尝试过这个:
\n\n String IdFolder = (String) objects[0];\n Bitmap bitmapUpload = (Bitmap) objects[1];\n\n int byteSize = bitmapUpload.getRowBytes() * bitmapUpload.getHeight();\n ByteBuffer byteBuffer = ByteBuffer.allocate(byteSize);\n bitmap.copyPixelsToBuffer(byteBuffer);\n\n\n byte[] byteArray = byteBuffer.array();\n\n\n ByteArrayInputStream bs = new ByteArrayInputStream(byteArray);\n\n File fileMetadata …Run Code Online (Sandbox Code Playgroud)