【发布时间】:2014-07-05 00:04:29
【问题描述】:
我正在我的 Android 应用程序中上传一个文件。代码很简单:
private boolean UploadFile(String fileLocation) {
try {
if (TextUtils.isEmpty(fileLocation)) {
return false;
}
File fSrc = new File(fileLocation);
if (!fSrc.exists()) {
return false;
}
boolean bReturn = AzureManager.init(this);
if (!bReturn) {
return false;
}
String blobName = fSrc.getName();
InputStream in = new BufferedInputStream(new FileInputStream(fSrc));
CloudBlobContainer container = AzureManager.getCloudBlobClient().getContainerReference(AzureManager.getContainerName());
CloudBlockBlob blob = container.getBlockBlobReference(blobName);
blob.upload(in, fSrc.length());
in.close();
return true;
} catch (Exception e) {
//handle exception
}
return false;
}
当我从 Azure 下载时,CloudBlockBlob 有一个下载监听器:
blob.setDownloadListener(eventListener);
但是如何在上传时跟踪进度?
【问题讨论】:
-
嗨,你找到解决办法了吗?
-
嗨。我的队友疯狂地在 AzureSDK 中进行一些更改,但我真的不知道他做了什么,但这是我们可以获得百分比的方式。
标签: android azure azure-storage progress