• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DriveFileResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.android.gms.drive.DriveFolder.DriveFileResult的典型用法代码示例。如果您正苦于以下问题:Java DriveFileResult类的具体用法?Java DriveFileResult怎么用?Java DriveFileResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DriveFileResult类属于com.google.android.gms.drive.DriveFolder包,在下文中一共展示了DriveFileResult类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onResult

import com.google.android.gms.drive.DriveFolder.DriveFileResult; //导入依赖的package包/类
@Override
public void onResult(DriveFileResult result) {
    if (!result.getStatus().isSuccess()) {
        Log.i(TAG, "Error creating the file");
        Toast.makeText(UploadFileActivity.this,
                "Error adding file to Drive", Toast.LENGTH_SHORT).show();
        return;
    }
    Log.i(TAG, "File added to Drive");
    Log.i(TAG, "Created a file with content: "
            + result.getDriveFile().getDriveId());
    Toast.makeText(UploadFileActivity.this,
            "File successfully added to Drive", Toast.LENGTH_SHORT).show();
    final PendingResult<DriveResource.MetadataResult> metadata
            = result.getDriveFile().getMetadata(googleApiClient);
    metadata.setResultCallback(new
                                       ResultCallback<DriveResource.MetadataResult>() {
                                           @Override
                                           public void onResult(DriveResource.MetadataResult metadataResult) {
                                               Metadata data = metadataResult.getMetadata();
                                               Log.i(TAG, "Title: " + data.getTitle());
                                               drive_id = data.getDriveId().encodeToString();
                                               Log.i(TAG, "DrivId: " + drive_id);
                                               driveID = data.getDriveId();
                                               Log.i(TAG, "Description: " + data.getDescription().toString());
                                               Log.i(TAG, "MimeType: " + data.getMimeType());
                                               Log.i(TAG, "File size: " + String.valueOf(data.getFileSize()));
                                           }
                                       });
}
 
开发者ID:JonathanImperato,项目名称:Service-Notes,代码行数:31,代码来源:UploadFileActivity.java


示例2: createFile

import com.google.android.gms.drive.DriveFolder.DriveFileResult; //导入依赖的package包/类
public PendingResult<DriveFolder.DriveFileResult> createFile(GoogleApiClient paramGoogleApiClient, final MetadataChangeSet paramMetadataChangeSet, final Contents paramContents)
{
  if (paramMetadataChangeSet == null)
    throw new IllegalArgumentException("MetatadataChangeSet must be provided.");
  if (paramContents == null)
    throw new IllegalArgumentException("Contents must be provided.");
  if ("application/vnd.google-apps.folder".equals(paramMetadataChangeSet.getMimeType()))
    throw new IllegalArgumentException("May not create folders (mimetype: application/vnd.google-apps.folder) using this method. Use DriveFolder.createFolder() instead.");
  return paramGoogleApiClient.b(new i()
  {
    protected void a(j paramAnonymousj)
    {
      try
      {
        paramContents.close();
        paramAnonymousj.cN().a(new CreateFileRequest(l.this.getDriveId(), paramMetadataChangeSet.cM(), paramContents), new l.a(this));
        return;
      }
      catch (RemoteException localRemoteException)
      {
        a(new l.d(new Status(8, localRemoteException.getLocalizedMessage(), null), null));
      }
    }

    public DriveFolder.DriveFileResult q(Status paramAnonymousStatus)
    {
      return new l.d(paramAnonymousStatus, null);
    }
  });
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:31,代码来源:l.java


示例3: onResult

import com.google.android.gms.drive.DriveFolder.DriveFileResult; //导入依赖的package包/类
@Override
public void onResult(DriveFileResult result) {
    if (!result.getStatus().isSuccess()) {
        showMessage("Error while trying to create the file");
        return;
    }
    showMessage("Created a file: " + result.getDriveFile().getDriveId());
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:9,代码来源:CreateFileInFolderActivity.java


示例4: onResult

import com.google.android.gms.drive.DriveFolder.DriveFileResult; //导入依赖的package包/类
@Override
public void onResult(DriveFileResult result) {
    if (!result.getStatus().isSuccess()) {
        showMessage("Error while trying to create the file");
        return;
    }
    showMessage("Created a file in App Folder: "
            + result.getDriveFile().getDriveId());
}
 
开发者ID:benbek,项目名称:HereAStory-Android,代码行数:10,代码来源:CreateFileInAppFolderActivity.java


示例5: createFile

import com.google.android.gms.drive.DriveFolder.DriveFileResult; //导入依赖的package包/类
public DriveFile createFile(File file) {
		ContentsResult result = Drive.DriveApi.newContents(mGoogleApiClient).await();
		if (!result.getStatus().isSuccess()) return null;
		
		MetadataChangeSet changeSet = new MetadataChangeSet.Builder()
				.setTitle(file.getName())
				.setMimeType(getMimeType(file.getAbsolutePath()))
				.build();
		DriveFileResult mDriveFileResult = Drive.DriveApi
//				.getAppFolder(mGoogleApiClient)
				.getRootFolder(mGoogleApiClient)
				.createFile(mGoogleApiClient, changeSet,
						result.getContents()).await();
		return mDriveFileResult.getDriveFile();
	}
 
开发者ID:kanpol,项目名称:omni-note,代码行数:16,代码来源:DriveHelper.java


示例6: a

import com.google.android.gms.drive.DriveFolder.DriveFileResult; //导入依赖的package包/类
public a(a.c<DriveFolder.DriveFileResult> paramc)
{
  this.jW = paramc;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:5,代码来源:l.java


示例7: doInBackgroundConnected

import com.google.android.gms.drive.DriveFolder.DriveFileResult; //导入依赖的package包/类
@Override
protected Metadata doInBackgroundConnected(Void... arg0) {

    // First we start by creating a new contents, and blocking on the
    // result by calling await().
    ContentsResult contentsResult =
            Drive.DriveApi.newContents(getGoogleApiClient()).await();
    if (!contentsResult.getStatus().isSuccess()) {
        // We failed, stop the task and return.
        return null;
    }

    // Read the contents and open its output stream for writing, then
    // write a short message.
    Contents originalContents = contentsResult.getContents();
    OutputStream os = originalContents.getOutputStream();
    try {
        os.write("Hello world!\n".getBytes());
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }

    // Create the metadata for the new file including title and MIME
    // type.
    MetadataChangeSet originalMetadata = new MetadataChangeSet.Builder()
            .setTitle("AsyncTaskFile.txt")
            .setMimeType("text/plain").build();

    // Create the file in the root folder, again calling await() to
    // block until the request finishes.
    DriveFolder rootFolder = Drive.DriveApi.getRootFolder(getGoogleApiClient());
    DriveFileResult fileResult = rootFolder.createFile(
            getGoogleApiClient(), originalMetadata, originalContents).await();
    if (!fileResult.getStatus().isSuccess()) {
        // We failed, stop the task and return.
        return null;
    }

    // Finally, fetch the metadata for the newly created file, again
    // calling await to block until the request finishes.
    MetadataResult metadataResult = fileResult.getDriveFile()
            .getMetadata(getGoogleApiClient())
            .await();
    if (!metadataResult.getStatus().isSuccess()) {
        // We failed, stop the task and return.
        return null;
    }
    // We succeeded, return the newly created metadata.
    return metadataResult.getMetadata();
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:52,代码来源:SyncRequestsActivity.java



注:本文中的com.google.android.gms.drive.DriveFolder.DriveFileResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java QueryPagers类代码示例发布时间:2022-05-23
下一篇:
Java SegmentList类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap