本文整理汇总了Java中com.microsoft.windowsazure.mobileservices.ServiceFilterResponseCallback类的典型用法代码示例。如果您正苦于以下问题:Java ServiceFilterResponseCallback类的具体用法?Java ServiceFilterResponseCallback怎么用?Java ServiceFilterResponseCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceFilterResponseCallback类属于com.microsoft.windowsazure.mobileservices包,在下文中一共展示了ServiceFilterResponseCallback类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import com.microsoft.windowsazure.mobileservices.ServiceFilterResponseCallback; //导入依赖的package包/类
/**
* Execute a request-response operation with a Mobile Service
*
* @param request The request to execute
* @param responseCallback Callback to invoke after the request is executed
*/
public void start(final ServiceFilterRequest request, final ServiceFilterResponseCallback responseCallback) {
ListenableFuture<ServiceFilterResponse> startFuture = start(request);
Futures.addCallback(startFuture, new FutureCallback<ServiceFilterResponse>() {
@Override
public void onFailure(Throwable exception) {
if (exception instanceof Exception) {
responseCallback.onResponse(MobileServiceException.getServiceResponse(exception), (Exception) exception);
} else {
responseCallback.onResponse(MobileServiceException.getServiceResponse(exception), new Exception(exception));
}
}
@Override
public void onSuccess(ServiceFilterResponse response) {
responseCallback.onResponse(response, null);
}
});
}
示例2: handleRequest
import com.microsoft.windowsazure.mobileservices.ServiceFilterResponseCallback; //导入依赖的package包/类
@Override
public void handleRequest(ServiceFilterRequest request, NextServiceFilterCallback nextServiceFilterCallback,
final ServiceFilterResponseCallback responseCallback) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (mProgressBar != null) mProgressBar.setVisibility(ProgressBar.VISIBLE);
}
});
nextServiceFilterCallback.onNext(request, new ServiceFilterResponseCallback() {
@Override
public void onResponse(ServiceFilterResponse response, Exception exception) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (mProgressBar != null) mProgressBar.setVisibility(ProgressBar.GONE);
}
});
if (responseCallback != null) responseCallback.onResponse(response, exception);
}
});
}
示例3: handleRequest
import com.microsoft.windowsazure.mobileservices.ServiceFilterResponseCallback; //导入依赖的package包/类
@Override
public void handleRequest(final ServiceFilterRequest request, final NextServiceFilterCallback nextServiceFilterCallback,
final ServiceFilterResponseCallback responseCallback) {
if (!NetworkUtilities.isNetworkOnline(mContext)) {
getActivityContext().runOnUiThread(new Runnable() {
@Override
public void run() {
LensRocketAlert.showSimpleErrorDialog(getActivityContext(), "You must be connected to the internet for this to work.");
}
});
responseCallback.onResponse(null, new NoNetworkConnectivityException());
return;
}
nextServiceFilterCallback.onNext(request, new ServiceFilterResponseCallback() {
@Override
public void onResponse(ServiceFilterResponse response, Exception ex) {
if (ex == null) {
StatusLine status = response.getStatus();
int statusCode = status.getStatusCode();
if (statusCode == 401) {
//Kick user out
LensRocketLogger.i(TAG, "401 received, forcing logout");
//TODO force logout
}
} else if (ex.getCause() != null) {
if (UnknownHostException.class.isInstance(ex.getCause())) {
LensRocketLogger.e(TAG, "UnknownHost");
getActivityContext().runOnUiThread(new Runnable() {
@Override
public void run() {
LensRocketAlert.showSimpleErrorDialog(getActivityContext(), "You must be connected to the internet for this to work.");
}
});
} else {
LensRocketLogger.e(TAG, "Error in handle request: " + ex.getCause().getMessage());
}
} else
LensRocketLogger.e(TAG, "Error in handle request: " + ex.getMessage());
if (responseCallback != null) responseCallback.onResponse(response, ex);
}
});
}