本文整理汇总了Java中com.qiniu.android.http.ResponseInfo.isOK方法的典型用法代码示例。如果您正苦于以下问题:Java ResponseInfo.isOK方法的具体用法?Java ResponseInfo.isOK怎么用?Java ResponseInfo.isOK使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.qiniu.android.http.ResponseInfo
的用法示例。
在下文中一共展示了ResponseInfo.isOK方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: uploadphoto
import com.qiniu.android.http.ResponseInfo; //导入方法依赖的package包/类
public void uploadphoto(File file) {
if (StringUtils.isNotEmpty(token)) {
UpCompletionHandler handler = new UpCompletionHandler() {
@Override
public void complete(String key, ResponseInfo info, JSONObject res) {
//res包含hash、key等信息,具体字段取决于上传策略的设置
if (info.isOK()) {
Log.i("qiniu", "Upload Success");
try {
ImgPath = BuildConfig.QiniuBase+ res.getString("key");
delegate.setmImgAdd(ImgPath);
} catch (JSONException e) {
e.printStackTrace();
}
} else {
Log.i("qiniu", "Upload Fail");
//如果失败,这里可以把info信息上报自己的服务器,便于后面分析上传错误原因
}
Log.i("qiniu", key + ",\r\n " + info + ",\r\n " + res);
}
};
QiniuUpload.getInstance().uploadFile(token, file, handler);
}
}
示例2: uploadphoto
import com.qiniu.android.http.ResponseInfo; //导入方法依赖的package包/类
public void uploadphoto(File file) {
if (StringUtils.isNotEmpty(token)) {
UpCompletionHandler handler = new UpCompletionHandler() {
@Override
public void complete(String key, ResponseInfo info, JSONObject res) {
//res包含hash、key等信息,具体字段取决于上传策略的设置
if (info.isOK()) {
Log.i("qiniu", "Upload Success");
try {
String photoName = res.getString("key");
ArrayList<String> data = new ArrayList<>();
data.add(BuildConfig.QiniuBase + photoName);
delegate.setData(data);
} catch (JSONException e) {
e.printStackTrace();
}
} else {
Log.i("qiniu", "Upload Fail");
//如果失败,这里可以把info信息上报自己的服务器,便于后面分析上传错误原因
}
Log.i("qiniu", key + ",\r\n " + info + ",\r\n " + res);
}
};
QiniuUpload.getInstance().uploadFile(token, file, handler);
}
}
示例3: uploadphoto
import com.qiniu.android.http.ResponseInfo; //导入方法依赖的package包/类
public void uploadphoto(File file) {
if (StringUtils.isNotEmpty(token)) {
UpCompletionHandler handler = new UpCompletionHandler() {
@Override
public void complete(String key, ResponseInfo info, JSONObject res) {
//res包含hash、key等信息,具体字段取决于上传策略的设置
if (info.isOK()) {
Log.i("qiniu", "Upload Success");
try {
String photoName = res.getString("key");
// ArrayList<String> data = new ArrayList<>();
// data.add(photoName);
PicPath = BuildConfig.QiniuBase+photoName;
delegate.setmImgPic(photoName);
} catch (JSONException e) {
e.printStackTrace();
}
} else {
Log.i("qiniu", "Upload Fail");
//如果失败,这里可以把info信息上报自己的服务器,便于后面分析上传错误原因
}
Log.i("qiniu", key + ",\r\n " + info + ",\r\n " + res);
}
};
QiniuUpload.getInstance().uploadFile(token, file, handler);
}
}
示例4: uploadPhoto
import com.qiniu.android.http.ResponseInfo; //导入方法依赖的package包/类
public void uploadPhoto(File file, final int type) {
if (StringUtils.isNotEmpty(token)) {
UpCompletionHandler handler = new UpCompletionHandler() {
@Override
public void complete(String key, ResponseInfo info, JSONObject res) {
//res包含hash、key等信息,具体字段取决于上传策略的设置
if (info.isOK()) {
Log.i("qiniu", "Upload Success");
try {
if (type == 0) {
ImgPath = BuildConfig.QiniuBase + res.getString("key");
delegate.setImgAdd(ImgPath);
} else if (type == 1) {
pics.add(BuildConfig.QiniuBase + res.getString("key"));
delegate.setData(pics);
}
// } else if (type == 1) {
// pics.add(BuildConfig.QiniuBase + res.getString("key"));
// delegate.setData(pics);
// }
} catch (JSONException e) {
e.printStackTrace();
}
} else {
Log.i("qiniu", "Upload Fail");
//如果失败,这里可以把info信息上报自己的服务器,便于后面分析上传错误原因
}
Log.i("qiniu", key + ",\r\n " + info + ",\r\n " + res);
}
};
QiniuUpload.getInstance().uploadFile(token, file, handler);
}
}
示例5: doUpload
import com.qiniu.android.http.ResponseInfo; //导入方法依赖的package包/类
public void doUpload(final ArrayList<String> files, int postion) {
if (postion >= files.size()) {
return;
}
String path = files.get(postion);
File file = BitmapUtil.saveBitmapFile(BitmapUtil.getBitmap(path), path);
if (StringUtils.isNotEmpty(token)) {
UpCompletionHandler handler = new UpCompletionHandler() {
@Override
public void complete(String key, ResponseInfo info, JSONObject res) {
//res包含hash、key等信息,具体字段取决于上传策略的设置
if (info.isOK()) {
Log.i("qiniu", "Upload Success");
try {
// if (type == 0) {
// String img = res.getString("key");
pics.add(BuildConfig.QiniuBase + res.getString("key"));
delegate.setData(pics);
imgPosition++;
doUpload(files, imgPosition);
// delegate.setImgAdd(ImgPath);
// } else if (type == 1) {
// delegate.setData(pics);
// }
} catch (JSONException e) {
e.printStackTrace();
}
} else {
Log.i("qiniu", "Upload Fail");
//如果失败,这里可以把info信息上报自己的服务器,便于后面分析上传错误原因
}
Log.i("qiniu", key + ",\r\n " + info + ",\r\n " + res);
}
};
QiniuUpload.getInstance().uploadFile(token, file, handler);
}
}