本文整理汇总了Java中cn.bmob.v3.datatype.BmobFile.uploadblock方法的典型用法代码示例。如果您正苦于以下问题:Java BmobFile.uploadblock方法的具体用法?Java BmobFile.uploadblock怎么用?Java BmobFile.uploadblock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.bmob.v3.datatype.BmobFile
的用法示例。
在下文中一共展示了BmobFile.uploadblock方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateImageFile
import cn.bmob.v3.datatype.BmobFile; //导入方法依赖的package包/类
private void updateImageFile(File imageFile) {
final BmobFile file = new BmobFile(imageFile);
file.uploadblock(new UploadFileListener() {
@Override
public void done(BmobException e) {
if (e == null) {
Log.i(TAG, "file.uploadblock:success ");
createFaceSet(file.getFileUrl());
} else {
Log.e(TAG, "file.uploadblock:failed ", e);
Message message = new Message();
message.arg1 = FinalUtil.UPDATE_PICTURE_EXCEPTION;
myhandler.sendMessage(message);
}
}
@Override
public void onProgress(Integer value) {
super.onProgress(value);
Log.i(TAG, "onProgress: " + value);
}
});
}
示例2: upLoadAvatar
import cn.bmob.v3.datatype.BmobFile; //导入方法依赖的package包/类
private void upLoadAvatar() {
File file = new File(cropFileUri.getPath());
bf = new BmobFile(file);
bf.uploadblock(new UploadFileListener() {
@Override
public void done(BmobException e) {
if (e == null) {
showToast("上传成功!");
// 先加载本地的图片
loadImage(bf.getUrl(), ivPhoto);
} else {
showToast("上传失败!"+e.getErrorCode()+e.getMessage());
}
}
});
}
示例3: upLoadAudio
import cn.bmob.v3.datatype.BmobFile; //导入方法依赖的package包/类
/**
* 上传录音
*/
private void upLoadAudio() {
File f = new File(recorderPath);
if (!f.exists()) {
T.show(context, "文件出错");
}
L.i("录音文件路径" + recorderPath);
final BmobFile bf = new BmobFile(f);
loading.setVisibility(0);
bf.uploadblock(context, new UploadFileListener() {
@Override
public void onSuccess() {
audioUrl = bf.getFileUrl(context);
loading.setVisibility(View.GONE);
L.e("录音上传成功:" + audioUrl);
}
@Override
public void onFailure(int arg0, String arg1) {
// loading.setVisibility(View.GONE);
L.e("录音上传失败" + arg0 + arg1);
}
});
}
示例4: uploadPic
import cn.bmob.v3.datatype.BmobFile; //导入方法依赖的package包/类
/**
* 上传图片更新网络信息
*
* @param f
*/
private void uploadPic(File f) {
loader.displayImage("file://" + f.getAbsolutePath(), iv_photo, option_pic);
final BmobFile bf = new BmobFile(f);
bf.uploadblock(context, new UploadFileListener() {
@Override
public void onSuccess() {
currentUser.setAvatar(bf.getFileUrl(getApplicationContext()));
loader.displayImage(bf.getFileUrl(getApplicationContext()), iv_photo, option_pic);
}
@Override
public void onFailure(int arg0, String arg1) {
T.show(context, "上传失败");
}
});
}
示例5: upLoadFile
import cn.bmob.v3.datatype.BmobFile; //导入方法依赖的package包/类
/**
* 上传一个文件
*
* @param context
* @param f
* @param upLoadListener
*/
public static void upLoadFile(final Context context, File f, final UpLoadListener upLoadListener) {
final BmobFile bf = new BmobFile(f);
bf.uploadblock(context, new UploadFileListener() {
@Override
public void onSuccess() {
L.d("上传文件成功" + bf.getFileUrl(context));
upLoadListener.onSuccess(bf.getFileUrl(context));
}
@Override
public void onFailure(int arg0, String arg1) {
L.d("上传文件失败" + arg0 + arg1);
upLoadListener.onFailure(arg0, arg1);
}
});
}
示例6: updateImageFile
import cn.bmob.v3.datatype.BmobFile; //导入方法依赖的package包/类
private void updateImageFile(File imageFile, final UserHasSigned userHasSigned, final DatabaseAdapter db) {
final BmobFile file = new BmobFile(imageFile);
file.uploadblock(new UploadFileListener() {
@Override
public void done(BmobException e) {
if (e == null) {
Log.i(TAG, "file.uploadblock:success ");
userHasSigned.setFace_url1(file.getFileUrl());
Log.i(TAG, "file.uploadblock:if ");
dialog.setMessage("上传图片成功!");
dialog.show();
new Thread(new Runnable() {
@Override
public void run() {
BmobDataHelper bmobDataHelper = new BmobDataHelper(RegisterFaceActivity.this, myhandler);
bmobDataHelper.addUserHasSign(userHasSigned);
}
}).start();
} else {
Log.e(TAG, "file.uploadblock:failed ", e);
Message message = new Message();
message.arg1 = FinalUtil.DETECT_FAILED_IO_EXCEPTION;
myhandler.sendMessage(message);
}
}
@Override
public void onProgress(Integer value) {
super.onProgress(value);
Log.i(TAG, "onProgress: " + value);
fileUploadProgress = value;
}
});
}
示例7: uploadAvatar
import cn.bmob.v3.datatype.BmobFile; //导入方法依赖的package包/类
private void uploadAvatar(File file) {
BmobFile bmobFile = new BmobFile(file);
bmobFile.uploadblock(new UploadFileListener() {
@Override
public void done(BmobException e) {
if (e == null) {
Toast.makeText(UserActivity.this, "头像保存成功",
Toast.LENGTH_SHORT).show();
} else {
LogUtil.e(e.toString());
}
}
});
}
示例8: uploadHeader
import cn.bmob.v3.datatype.BmobFile; //导入方法依赖的package包/类
@NeedsPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
protected void uploadHeader(final Uri saveUri) {
final BmobFile bmobFile = new BmobFile(new File(URI.create(saveUri.toString())));
mHeaderView.setImageURI(saveUri);
bmobFile.uploadblock(MainActivity.this, new UploadFileListener() {
@Override
public void onSuccess() {
// TODO Auto-generated method stub
//bmobFile.getUrl()---返回的上传文件的地址(不带域名)
//bmobFile.getFileUrl(context)--返回的上传文件的完整地址(带域名)
Logs.e("fileUrl:" + bmobFile.getFileUrl(MainActivity.this));
PineApplication.mCurrentUser.setAvatar(bmobFile.getFileUrl(MainActivity.this));
mAccountService.updateServerUser(MainActivity.this, PineApplication.mCurrentUser);
}
@Override
public void onProgress(Integer value) {
// TODO Auto-generated method stub
// 返回的上传进度(百分比)
Logs.e("Progress: " + value + "%");
}
@Override
public void onFailure(int code, String msg) {
// TODO Auto-generated method stub
Logs.e("上传文件失败:" + msg);
}
});
}
示例9: call
import cn.bmob.v3.datatype.BmobFile; //导入方法依赖的package包/类
@Override
public Boolean call() throws Exception {
if(!TextUtils.isEmpty(mFilePath)){
mFile = new File(mFilePath);
}
if(null==mFile||!mFile.exists()){
throw new FileNotFoundException();
}
final BmobFile bmobFile = new BmobFile(mFile);
bmobFile.uploadblock(PineApplication.mContext, new UploadFileListener() {
@Override
public void onSuccess() {
Logs.e("bmobFile upload onSuccess: " + bmobFile.getFileUrl(PineApplication.mContext));
FileUploader.this.mUploadListener.onSuccess(mFile,bmobFile.getFileUrl(PineApplication.mContext));
}
@Override
public void onFailure(int i, String s) {
Logs.e("bmobFile upload onFailure: " + s);
FileUploader.this.mUploadListener.onFailure(i,s);
}
});
return true;
}
示例10: onActivityResult
import cn.bmob.v3.datatype.BmobFile; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
L.d(requestCode + "," + resultCode + "," + data);
if (resultCode == RESULT_OK) {
List<String> images = data.getStringArrayListExtra(AlbumActivity.INTENT_SELECTED_PICTURE);
if (images == null || images.size() <= 0) {
return;
}
File f = new File(images.get(0));
L.e("照片路径:" + f.getAbsolutePath());
if (f.exists()) {
final BmobFile bf = new BmobFile(f);
bf.uploadblock(context, new UploadFileListener() {
@Override
public void onSuccess() {
list.add(bf.getFileUrl(getApplicationContext()));
adapter.notifyDataSetChanged();
updateAlbum();
}
@Override
public void onFailure(int arg0, String arg1) {
T.show(context, "上传失败");
}
});
}
}
super.onActivityResult(requestCode, resultCode, data);
}
示例11: upload
import cn.bmob.v3.datatype.BmobFile; //导入方法依赖的package包/类
public void upload(BmobFile bmobFile, UploadFileListener listener){
bmobFile.uploadblock(mContext, listener);
}