本文整理汇总了Java中com.vk.sdk.util.VKJsonHelper类的典型用法代码示例。如果您正苦于以下问题:Java VKJsonHelper类的具体用法?Java VKJsonHelper怎么用?Java VKJsonHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VKJsonHelper类属于com.vk.sdk.util包,在下文中一共展示了VKJsonHelper类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: VKError
import com.vk.sdk.util.VKJsonHelper; //导入依赖的package包/类
/**
* Generate API error from JSON
*
* @param json Json description of VK API error
*/
@SuppressWarnings("unchecked")
public VKError(JSONObject json) throws JSONException {
VKError internalError = new VKError(json.getInt(VKApiConst.ERROR_CODE));
internalError.errorMessage = json.getString(VKApiConst.ERROR_MSG);
internalError.requestParams = (ArrayList<Map<String, String>>) VKJsonHelper.toList(
json.getJSONArray(VKApiConst.REQUEST_PARAMS));
if (internalError.errorCode == 14) {
internalError.captchaImg = json.getString(VKApiConst.CAPTCHA_IMG);
internalError.captchaSid = json.getString(VKApiConst.CAPTCHA_SID);
}
if (internalError.errorCode == 17) {
internalError.redirectUri = json.getString(VKApiConst.REDIRECT_URI);
}
this.errorCode = VK_API_ERROR;
this.apiError = internalError;
}
示例2: getSaveRequest
import com.vk.sdk.util.VKJsonHelper; //导入依赖的package包/类
@Override
protected VKRequest getSaveRequest(JSONObject response) {
VKRequest saveRequest;
try {
saveRequest = VKApi.docs().save(new VKParameters(VKJsonHelper.toMap(response)));
} catch (JSONException e) {
return null;
}
if (mGroupId != 0)
saveRequest.addExtraParameters(VKUtil.paramsFrom(VKApiConst.GROUP_ID, mGroupId));
return saveRequest;
}
示例3: getSaveRequest
import com.vk.sdk.util.VKJsonHelper; //导入依赖的package包/类
@Override
protected VKRequest getSaveRequest(JSONObject response) {
VKRequest saveRequest;
try {
saveRequest = VKApi.photos().saveWallPhoto(new VKParameters(VKJsonHelper.toMap(response)));
} catch (JSONException e) {
return null;
}
if (mUserId != 0)
saveRequest.addExtraParameters(VKUtil.paramsFrom(VKApiConst.USER_ID, mUserId));
if (mGroupId != 0)
saveRequest.addExtraParameters(VKUtil.paramsFrom(VKApiConst.GROUP_ID, mGroupId));
return saveRequest;
}
示例4: getSaveRequest
import com.vk.sdk.util.VKJsonHelper; //导入依赖的package包/类
@Override
protected VKRequest getSaveRequest(JSONObject response) {
VKRequest saveRequest;
try {
saveRequest = VKApi.photos().save(new VKParameters(VKJsonHelper.toMap(response)));
} catch (JSONException e) {
return null;
}
if (mAlbumId != 0)
saveRequest.addExtraParameters(VKUtil.paramsFrom(VKApiConst.ALBUM_ID, mAlbumId));
if (mGroupId != 0)
saveRequest.addExtraParameters(VKUtil.paramsFrom(VKApiConst.GROUP_ID, mGroupId));
return saveRequest;
}
示例5: getSaveRequest
import com.vk.sdk.util.VKJsonHelper; //导入依赖的package包/类
@Override
protected VKRequest getSaveRequest(JSONObject response) {
VKRequest saveRequest;
try {
saveRequest = VKApi.photos().saveMessagesPhoto(new VKParameters(VKJsonHelper.toMap(response)));
} catch (JSONException e) {
return null;
}
return saveRequest;
}
示例6: VKError
import com.vk.sdk.util.VKJsonHelper; //导入依赖的package包/类
/**
* Generate API error from JSON
*
* @param json Json description of VK API error
*/
@SuppressWarnings("unchecked")
public VKError(JSONObject json) throws JSONException {
VKError internalError = new VKError(json.getInt(VKApiConst.ERROR_CODE));
internalError.errorMessage = json.getString(VKApiConst.ERROR_MSG);
internalError.requestParams = (ArrayList<Map<String, String>>) VKJsonHelper.toList(
json.getJSONArray(VKApiConst.REQUEST_PARAMS));
if (internalError.errorCode == 14) {
internalError.captchaImg = json.getString(VKApiConst.CAPTCHA_IMG);
internalError.captchaSid = json.getString(VKApiConst.CAPTCHA_SID);
}
this.errorCode = VK_API_ERROR;
this.apiError = internalError;
}
示例7: callApiMethod
import com.vk.sdk.util.VKJsonHelper; //导入依赖的package包/类
private boolean callApiMethod(String method, JSONObject params, CallbackContext context) {
try {
VKRequest req = new VKRequest(method, new VKParameters(VKJsonHelper.toMap(params)));
performRequest(req, context);
return true;
} catch(Exception ex) {
return false;
}
}