接口 PendingResult<T>
- 类型参数:
T- the type of the result object.
- 所有已知实现类:
DirectionsApiRequest,DirectionsTableApiRequest,DistanceMatrixApiRequest,FindPlaceFromTextRequest,GaePendingResult,GeocodingApiRequest,GeolocationApiRequest,NearbySearchRequest,OkHttpPendingResult,PhotoRequest,PlaceAutocompleteRequest,QueryAutocompleteRequest,TextSearchRequest
public interface PendingResult<T>
A pending result from an API call.
-
嵌套类概要
嵌套类 修饰符和类型 接口 说明 static interfacePendingResult.Callback<T>The callback interface the API client code needs to implement to handle API results. -
方法概要
修饰符和类型 方法 说明 Tawait()Performs the request synchronously.TawaitIgnoreError()Performs the request synchronously, ignoring exceptions while performing the request and errors returned by the server.voidcancel()Attempts to cancel the request.voidsetCallback(PendingResult.Callback<T> callback)
-
方法详细资料
-
setCallback
Performs the request asynchronously, callingonResultoronFailureafter the request has been completed.- 参数:
callback- The callback to call on completion.
-
await
Performs the request synchronously.- 返回:
- The result.
- 抛出:
ApiException- Thrown if the API Returned result is an error.java.lang.InterruptedException- Thrown when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted.java.io.IOException- Thrown when an I/O exception of some sort has occurred.
-
awaitIgnoreError
T awaitIgnoreError()Performs the request synchronously, ignoring exceptions while performing the request and errors returned by the server.- 返回:
- The result, or null if there was any error or exception ignored.
-
cancel
void cancel()Attempts to cancel the request.
-