本文整理汇总了Java中com.vk.sdk.api.VKRequest.executeWithListener方法的典型用法代码示例。如果您正苦于以下问题:Java VKRequest.executeWithListener方法的具体用法?Java VKRequest.executeWithListener怎么用?Java VKRequest.executeWithListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vk.sdk.api.VKRequest
的用法示例。
在下文中一共展示了VKRequest.executeWithListener方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import com.vk.sdk.api.VKRequest; //导入方法依赖的package包/类
@Override
public FREObject call( FREContext context, FREObject[] args ) {
super.call( context, args );
FREArray params = (args[1] != null) ? (FREArray) args[1] : null;
VKParameters vkParameters = new VKParameters();
String errorMessage = parseRequestParameters( params, vkParameters );
mRequestId = FREObjectUtils.getInt( args[2] );
/* Send request if there's no error parsing the parameters */
if( errorMessage == null ) {
String method = FREObjectUtils.getString( args[0] );
/* Execute the request */
AIR.log( "Sending VKRequest " + method );
VKRequest request = new VKRequest( method );
request.addExtraParameters( vkParameters );
request.executeWithListener( getRequestListener( mRequestId ) );
}
/* Or dispatch error */
else {
AIR.log( "Error parsing request parameters: " + errorMessage );
AIR.dispatchEvent( AIRVKEvent.VK_REQUEST_ERROR, StringUtils.getEventErrorJSON( mRequestId, errorMessage ) );
}
return null;
}
示例2: setPhoto
import com.vk.sdk.api.VKRequest; //导入方法依赖的package包/类
public void setPhoto(final ImageView imageView, final Button button){
VKParameters params = new VKParameters();
params.put(VKApiConst.FIELDS, "photo_max_orig");
VKRequest request = new VKRequest("users.get",params);
request.executeWithListener(new VKRequest.VKRequestListener() {
@Override
public void onComplete(VKResponse response) {
super.onComplete(response);
JSONArray resp = null;
try {
resp = response.json.getJSONArray("response");
JSONObject user = resp.getJSONObject(0);
String photo_max_orig_url = user.getString("photo_max_orig");
imageView.setVisibility(View.VISIBLE);
button.setVisibility(View.GONE);
Glide.with(context).load(photo_max_orig_url).into(imageView);
} catch (JSONException e) {
Log.d("VkSdkHelper", String.valueOf(e));
}
}
@Override
public void onError(VKError error) {
super.onError(error);
}
});
}
示例3: notificationBlock
import com.vk.sdk.api.VKRequest; //导入方法依赖的package包/类
public void notificationBlock(){
VKParameters params = new VKParameters();
params.put("time","-1");
VKRequest request = new VKRequest("account.setSilenceMode",params);
request.executeWithListener(new VKRequest.VKRequestListener() {
/*@Override
public void onError(VKError error) {
Log.d("Block", error.errorMessage);
}*/
});
}
示例4: notificationReturn
import com.vk.sdk.api.VKRequest; //导入方法依赖的package包/类
public void notificationReturn(){
VKParameters params = new VKParameters();
params.put("time","0");
VKRequest request = new VKRequest("account.setSilenceMode",params);
request.executeWithListener(new VKRequest.VKRequestListener() {
/*@Override
public void onError(VKError error) {
Log.d("RETURN NOTIFICATION",error.errorMessage);
}*/
});
}
示例5: setStatus
import com.vk.sdk.api.VKRequest; //导入方法依赖的package包/类
public void setStatus(String status){
VKParameters params = new VKParameters();
params.put("text", status);
VKRequest request = new VKRequest("status.set",params);
request.executeWithListener(new VKRequest.VKRequestListener() {
/*@Override
public void onError(VKError error) {
Log.d("Status",error.errorMessage);
}*/
});
}
示例6: executeSyncWithListener
import com.vk.sdk.api.VKRequest; //导入方法依赖的package包/类
public static void executeSyncWithListener(@NonNull VKRequest vkRequest, @NonNull VKRequest.VKRequestListener vkListener) {
Listener listener = new Listener(vkListener);
vkRequest.setUseLooperForCallListener(false);
vkRequest.executeWithListener(listener);
synchronized (listener.syncObj) {
while (!listener.isFinish) {
try {
listener.syncObj.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
示例7: trackVisitor
import com.vk.sdk.api.VKRequest; //导入方法依赖的package包/类
private static void trackVisitor(VKRequest.VKRequestListener l) {
VKRequest r = new VKRequest("stats.trackVisitor");
r.attempts = 0;
r.executeWithListener(l);
}