本文整理汇总了Java中com.avos.avoscloud.AVFile.saveInBackground方法的典型用法代码示例。如果您正苦于以下问题:Java AVFile.saveInBackground方法的具体用法?Java AVFile.saveInBackground怎么用?Java AVFile.saveInBackground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.avos.avoscloud.AVFile
的用法示例。
在下文中一共展示了AVFile.saveInBackground方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateUserInfo
import com.avos.avoscloud.AVFile; //导入方法依赖的package包/类
/**
* 上传用户信息,首先上传头像,上传成功后赶回头像地址,然后上传其他信息
*/
private void updateUserInfo(Bitmap avatar) {
//如果头像为空,也就是用户没有上传头像,则使用之前的头像地址
if (avatar == null) {
} else {
final AVFile avatarFile = new AVFile("user_avatar.jpeg", ImageUtil.bitmap2Bytes(avatar));
avatarFile.saveInBackground(new SaveCallback() {
@Override
public void done(AVException e) {
if (e == null) {
Log.i("lin", "----lin----> imgUrl" + avatarFile.getUrl());
_cardView = avatarFile.getUrl();
}
}
});
}
}
示例2: updateUserInfo
import com.avos.avoscloud.AVFile; //导入方法依赖的package包/类
/**
* 上传用户信息,首先上传头像,上传成功后赶回头像地址,然后上传其他信息
*/
private void updateUserInfo(Bitmap avatar) {
//如果头像为空,也就是用户没有上传头像,则使用之前的头像地址
if (avatar == null) {
} else {
final AVFile avatarFile = new AVFile("user_avatar.jpeg", ImageUtil.bitmap2Bytes(avatar));
avatarFile.saveInBackground(new SaveCallback() {
@Override
public void done(AVException e) {
if (e == null) {
Log.i("lin", "----lin----> imgUrl" + avatarFile.getUrl());
imageUrl = avatarFile.getUrl();
}
}
});
}
}
示例3: onCrash
import com.avos.avoscloud.AVFile; //导入方法依赖的package包/类
@Override
public void onCrash(File file) {
if (file != null && !Config.isDebugMode) {
//接下来要在此处加入将闪退日志回传到服务器的功能
try {
AVFile avFile = AVFile.withAbsoluteLocalPath(file.getName(), file.getAbsolutePath());
avFile.saveInBackground();
// AVObject crash = new AVObject("Crash");
// crash.put("user_tel", MyApplication.user);
// crash.put("crash_log", avFile);
// crash.saveInBackground();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
示例4: attachVoice
import com.avos.avoscloud.AVFile; //导入方法依赖的package包/类
/**
* 上传item的音频(OOM)
* @param item item
*/
private void attachVoice(AVObject item){
int id=item.getInt("jxhid");
File file=new File("mnt/shared/jxh/voiceFile/"+id+".mp3");
if(file.exists()){
try {
AVFile avFile=AVFile.withFile("jxh_"+id+".mp3",file);//大文件会OOM
avFile.saveInBackground();
item.put("voiceFile",avFile);
item.saveInBackground();
} catch (IOException e) {
Log.e("attachVoice", e.toString());
}
}else {
Log.e("attachVoice","voice file missing"+id);
}
}
示例5: createOrUpdateShot
import com.avos.avoscloud.AVFile; //导入方法依赖的package包/类
public static void createOrUpdateShot(final String title,final String githubUrl,final String description, final String image_uri, final SaveCallback saveCallback) {
String name = System.currentTimeMillis()+"";
if (image_uri != null) {
Uri uri=Uri.parse(image_uri);
byte[] data = ImageUtils.readFile(mContext,uri);
final AVFile file = new AVFile(name, data);
file.saveInBackground(new SaveCallback() {
@Override
public void done(AVException e) {
if (e != null) {
Log.d("wds",e.toString());
saveCallback.done(e);
} else {
String image_url = file.getUrl();
saveShot(title,githubUrl,description, image_url, saveCallback);
}
}
});
} else {
saveShot(title,githubUrl,description, "", saveCallback);
}
}
示例6: runSaveFileSync
import com.avos.avoscloud.AVFile; //导入方法依赖的package包/类
public static void runSaveFileSync(AVFile avFile) throws InterruptedException, AVException {
final CountDownLatch lock = new CountDownLatch(1);
final AVException[] exceptions = new AVException[1];
avFile.saveInBackground(new SaveCallback() {
@Override
public void done(AVException e) {
exceptions[0] = e;
lock.countDown();
}
});
lock.await();
if (exceptions[0] != null){
throw exceptions[0];
}
}
示例7: updateUserInfo
import com.avos.avoscloud.AVFile; //导入方法依赖的package包/类
/**
* 上传用户信息,首先上传头像,上传成功后赶回头像地址,然后上传其他信息
*/
private void updateUserInfo(Bitmap avatar) {
//如果头像为空,也就是用户没有上传头像,则使用之前的头像地址
if (avatar == null) {
} else {
final AVFile avatarFile = new AVFile("user_avatar.jpeg", ImageUtil.bitmap2Bytes(avatar));
avatarFile.saveInBackground(new SaveCallback() {
@Override
public void done(AVException e) {
if (e == null) {
Log.i("lin", "----lin----> imgUrl" + avatarFile.getUrl());
switch (imageWhere) {
case 1:
_picture1 = avatarFile.getUrl();
break;
case 2:
_picture2 = avatarFile.getUrl();
break;
case 3:
_picture3 = avatarFile.getUrl();
break;
}
}
}
});
}
}
示例8: register
import com.avos.avoscloud.AVFile; //导入方法依赖的package包/类
public static void register(final String username,final String password,final String cityStr,final String githubStr,final Uri avatar_uri,final SaveCallback saveCallback) {
final AVUser user = new AVUser();
String name = System.currentTimeMillis()+"";
if (avatar_uri != null) {
byte[] data = ImageUtils.readFile(mContext,avatar_uri);
final AVFile file = new AVFile(name, data);
file.saveInBackground(new SaveCallback() {
@Override
public void done(AVException e) {
if (e != null) {
Log.d("wds",e.toString());
} else {
if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(password)) {
user.setUsername(username);
user.setPassword(password);
}
user.put(UserDAO.LOCATION,cityStr);
user.put(UserDAO.GITHUB_URL,githubStr);
user.put(UserDAO.AVATAR_URL, file.getUrl());
user.saveInBackground(saveCallback);
}
}
});
}else {
if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(password)) {
user.setUsername(username);
user.setPassword(password);
}
user.put(UserDAO.LOCATION,cityStr);
user.put(UserDAO.GITHUB_URL,githubStr);
user.saveInBackground(saveCallback);
}
}
示例9: onActivityResult
import com.avos.avoscloud.AVFile; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 2000 && resultCode == Activity.RESULT_OK) {
Bitmap bitmap = getBitmapFromUrl(getPhotopath(), 617, 924);
saveScalePhoto(bitmap);
mImage.setImageBitmap(bitmap);
final AVFile file = new AVFile("imageTest.jpg", ImageUtil.bitmap2Bytes(bitmap));
Log.i("----lin----", "----lin----" + bitmap);
file.saveInBackground(new SaveCallback() {
@Override public void done(AVException e) {
//Log.i("----lin----", "----lin----" + e.toString());
Log.i("----lin----", "----lin----" + file.getUrl());
}
});
}
if (requestCode == 103) {
}
if (requestCode == 102) {
}
}